2023-08-21 12:41:50 +08:00
|
|
|
#!/bin/sh
|
2024-04-18 11:28:09 +08:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-09-30 11:09:50 +08:00
|
|
|
BASE_PATH=$(pwd)
|
|
|
|
|
2023-11-15 21:22:06 +08:00
|
|
|
npm run preview-build
|
2023-08-21 12:41:50 +08:00
|
|
|
|
2023-08-20 22:57:10 +08:00
|
|
|
rm -rf production-code
|
|
|
|
rm -rf ./daemon/dist ./daemon/production
|
|
|
|
rm -rf ./panel/dist ./panel/production
|
|
|
|
|
|
|
|
echo "Build daemon..."
|
2024-09-30 11:09:50 +08:00
|
|
|
cd "${BASE_PATH}/daemon"
|
2023-08-20 22:57:10 +08:00
|
|
|
npm run build
|
|
|
|
|
|
|
|
echo "Build panel..."
|
2024-09-30 11:09:50 +08:00
|
|
|
cd "${BASE_PATH}/panel"
|
2023-08-20 22:57:10 +08:00
|
|
|
npm run build
|
|
|
|
|
2023-08-20 23:06:38 +08:00
|
|
|
echo "Build frontend..."
|
2024-09-30 11:09:50 +08:00
|
|
|
cd "${BASE_PATH}/frontend"
|
2023-08-20 23:06:38 +08:00
|
|
|
npm run build
|
2023-08-20 22:57:10 +08:00
|
|
|
|
|
|
|
echo "Collecting files..."
|
2024-09-30 11:09:50 +08:00
|
|
|
cd "${BASE_PATH}"
|
2023-08-20 22:57:10 +08:00
|
|
|
|
|
|
|
mkdir production-code
|
|
|
|
mkdir production-code/daemon
|
|
|
|
mkdir production-code/web
|
|
|
|
mkdir production-code/web/public
|
|
|
|
|
2024-09-30 11:09:50 +08:00
|
|
|
mv "${BASE_PATH}/daemon/production/app.js" "${BASE_PATH}/production-code/daemon"
|
|
|
|
mv "${BASE_PATH}/daemon/production/app.js.map" "${BASE_PATH}/production-code/daemon"
|
|
|
|
cp -f "${BASE_PATH}/daemon/package.json" "${BASE_PATH}/production-code/daemon/package.json"
|
|
|
|
cp -f "${BASE_PATH}/daemon/package-lock.json" "${BASE_PATH}/production-code/daemon/package-lock.json"
|
2023-08-20 22:57:10 +08:00
|
|
|
|
2024-09-30 11:09:50 +08:00
|
|
|
mv "${BASE_PATH}/panel/production/app.js" "${BASE_PATH}/production-code/web"
|
|
|
|
mv "${BASE_PATH}/panel/production/app.js.map" "${BASE_PATH}/production-code/web"
|
|
|
|
cp -f "${BASE_PATH}/panel/package.json" "${BASE_PATH}/production-code/web/package.json"
|
|
|
|
cp -f "${BASE_PATH}/panel/package-lock.json" "${BASE_PATH}/production-code/web/package-lock.json"
|
2023-08-20 22:57:10 +08:00
|
|
|
|
2024-09-30 11:09:50 +08:00
|
|
|
mv "${BASE_PATH}"/frontend/dist/* "${BASE_PATH}/production-code/web/public"
|
2023-08-20 22:57:10 +08:00
|
|
|
|
2024-09-30 11:09:50 +08:00
|
|
|
rm -rf "${BASE_PATH}/daemon/dist" "${BASE_PATH}/daemon/production"
|
|
|
|
rm -rf "${BASE_PATH}/panel/dist" "${BASE_PATH}/panel/production"
|
|
|
|
rm -rf "${BASE_PATH}/frontend/dist"
|
2023-08-20 22:57:10 +08:00
|
|
|
|
2024-09-30 11:09:50 +08:00
|
|
|
cd "${BASE_PATH}/production-code/daemon"
|
2024-09-30 10:49:00 +08:00
|
|
|
npm install --production --no-fund --no-audit
|
2024-09-30 11:09:50 +08:00
|
|
|
cd "${BASE_PATH}/production-code/web"
|
2024-09-30 10:49:00 +08:00
|
|
|
npm install --production --no-fund --no-audit
|
|
|
|
|
2023-08-20 22:57:10 +08:00
|
|
|
echo "------------"
|
2024-04-18 11:28:09 +08:00
|
|
|
echo "Compilation completed!"
|
|
|
|
echo "Output Directory: ./production-code/"
|
|
|
|
echo "------------"
|