From 9683addf5677c8e851d2a52d9dd4ca265712ae93 Mon Sep 17 00:00:00 2001 From: unitwk Date: Mon, 21 Aug 2023 11:06:09 +0800 Subject: [PATCH] Feat: windows build script --- .gitignore | 3 --- build.bat | 47 ++++++++++++++++++++++++++++++++++++++++++ install-dependents.bat | 10 +++++++++ install-dependents.sh | 2 ++ npm-dev-macos.sh | 2 +- npm-dev-windows.sh | 3 +++ start-daemon.bat | 4 ++++ start-frontend.bat | 4 ++++ start-panel.bat | 4 ++++ 9 files changed, 75 insertions(+), 4 deletions(-) create mode 100755 build.bat create mode 100755 install-dependents.bat create mode 100644 npm-dev-windows.sh create mode 100755 start-daemon.bat create mode 100755 start-frontend.bat create mode 100755 start-panel.bat diff --git a/.gitignore b/.gitignore index c80c8d79..94b0c10d 100755 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,7 @@ npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* -test.txt -*.bat -src/public *.code-workspace vscode/ .vscode/ diff --git a/build.bat b/build.bat new file mode 100755 index 00000000..c8efcea1 --- /dev/null +++ b/build.bat @@ -0,0 +1,47 @@ +rd /s /q "production-code" +rd /s /q ".\daemon\dist" +rd /s /q ".\daemon\production" +rd /s /q ".\panel\dist" +rd /s /q ".\panel\production" + +echo "Build daemon..." +cd daemon +npm run build + +echo "Build panel..." +cd .. +cd panel +npm run build + +echo "Build frontend..." +cd .. +cd frontend +npm run build + +echo "Collecting files..." +cd .. + +mkdir "production-code" +mkdir "production-code\daemon" +mkdir "production-code\web" +mkdir "production-code\web\public" + +copy ".\daemon\production\app.js" ".\production-code\daemon\app.js" +copy ".\daemon\package.json" ".\production-code\daemon\package.json" +copy ".\daemon\package-lock.json" ".\production-code\daemon\package-lock.json" + +copy ".\panel\production\app.js" ".\production-code\web\app.js" +copy ".\panel\package.json" ".\production-code\web\package.json" +copy ".\panel\package-lock.json" ".\production-code\web\package-lock.json" + +xcopy ".\frontend\dist" ".\production-code\web\public" /E /I /H /Y + +rd /s /q ".\panel\production" +rd /s /q ".\daemon\production" +rd /s /q ".\daemon\dist" +rd /s /q ".\panel\dist" +rd /s /q ".\frontend\dist" + +echo "------------" +echo "Done!" +echo "------------" diff --git a/install-dependents.bat b/install-dependents.bat new file mode 100755 index 00000000..61833f26 --- /dev/null +++ b/install-dependents.bat @@ -0,0 +1,10 @@ +cd daemon +npm install +cd ../panel +npm install +cd ../frontend +npm install + +echo "------------" +echo "Done!" +echo "------------" \ No newline at end of file diff --git a/install-dependents.sh b/install-dependents.sh index 61833f26..e530e014 100755 --- a/install-dependents.sh +++ b/install-dependents.sh @@ -1,3 +1,5 @@ +#!/bin/sh + cd daemon npm install cd ../panel diff --git a/npm-dev-macos.sh b/npm-dev-macos.sh index 6e3a4847..06719cc7 100755 --- a/npm-dev-macos.sh +++ b/npm-dev-macos.sh @@ -2,4 +2,4 @@ open -a Terminal.app "start-daemon.sh" open -a Terminal.app "start-panel.sh" -open -a Terminal.app "start-frontend.sh" +./start-frontend.sh diff --git a/npm-dev-windows.sh b/npm-dev-windows.sh new file mode 100644 index 00000000..e5c3a0e0 --- /dev/null +++ b/npm-dev-windows.sh @@ -0,0 +1,3 @@ +start ./start-daemon.bat +start ./start-panel.bat +./start-frontend.bat diff --git a/start-daemon.bat b/start-daemon.bat new file mode 100755 index 00000000..f12e77dd --- /dev/null +++ b/start-daemon.bat @@ -0,0 +1,4 @@ +cd daemon +npm run dev + + diff --git a/start-frontend.bat b/start-frontend.bat new file mode 100755 index 00000000..e826e5f4 --- /dev/null +++ b/start-frontend.bat @@ -0,0 +1,4 @@ +cd frontend +npm run dev + + diff --git a/start-panel.bat b/start-panel.bat new file mode 100755 index 00000000..ff6a3a5c --- /dev/null +++ b/start-panel.bat @@ -0,0 +1,4 @@ +cd panel +npm run dev + +