chore: build.sh add "npm install"

This commit is contained in:
YuMao 2024-09-30 11:09:50 +08:00
parent fdaa87db68
commit ce94503b96
2 changed files with 29 additions and 22 deletions

View File

@ -2,6 +2,8 @@
set -e
BASE_PATH=$(pwd)
npm run preview-build
rm -rf production-code
@ -9,49 +11,45 @@ rm -rf ./daemon/dist ./daemon/production
rm -rf ./panel/dist ./panel/production
echo "Build daemon..."
cd daemon
cd "${BASE_PATH}/daemon"
npm run build
echo "Build panel..."
cd ..
cd panel
cd "${BASE_PATH}/panel"
npm run build
echo "Build frontend..."
cd ..
cd frontend
cd "${BASE_PATH}/frontend"
npm run build
echo "Collecting files..."
cd ..
cd "${BASE_PATH}"
mkdir production-code
mkdir production-code/daemon
mkdir production-code/web
mkdir production-code/web/public
mv ./daemon/production/app.js ./production-code/daemon
mv ./daemon/production/app.js.map ./production-code/daemon
cp -f ./daemon/package.json ./production-code/daemon/package.json
cp -f ./daemon/package-lock.json ./production-code/daemon/package-lock.json
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"
mv ./panel/production/app.js ./production-code/web
mv ./panel/production/app.js.map ./production-code/web
cp -f ./panel/package.json ./production-code/web/package.json
cp -f ./panel/package-lock.json ./production-code/web/package-lock.json
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"
mv ./frontend/dist/* ./production-code/web/public
mv "${BASE_PATH}"/frontend/dist/* "${BASE_PATH}/production-code/web/public"
rm -rf ./daemon/dist ./daemon/production
rm -rf ./panel/dist ./panel/production
rm -rf ./frontend/dist
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"
echo "npm install..."
cd production-code/daemon
cd "${BASE_PATH}/production-code/daemon"
npm install --production --no-fund --no-audit
cd ../web
cd "${BASE_PATH}/production-code/web"
npm install --production --no-fund --no-audit
cd ..
echo "------------"
echo "Compilation completed!"

View File

@ -0,0 +1,9 @@
#!/bin/bash
BASE_PATH=$(pwd)
cd "${BASE_PATH}/daemon"
npm install --production --no-fund --no-audit
cd "${BASE_PATH}/web"
npm install --production --no-fund --no-audit