From d40a339aec65650a76b414f397a637e656ba892b Mon Sep 17 00:00:00 2001 From: geht <2947093423@qq.com> Date: Tue, 16 Jun 2026 18:12:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8D=8A=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=B7=B2=E7=9F=A5=E9=97=AE=E9=A2=98=E5=B9=B6=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=E7=A8=B3=E5=AE=9A=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-frontend.bat | 29 +++++++++++++++++++++++++++++ deploy-frontend.bat | 27 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 build-frontend.bat create mode 100644 deploy-frontend.bat diff --git a/build-frontend.bat b/build-frontend.bat new file mode 100644 index 00000000..439033e0 --- /dev/null +++ b/build-frontend.bat @@ -0,0 +1,29 @@ +@echo off +setlocal +set REPO=%~dp0 +set WEBDIST=%REPO%web-dist + +echo [1/4] build frontend (pnpm build) ... +cd /d %REPO%jeecgboot-vue3 +call pnpm run build +if errorlevel 1 ( echo [ERROR] frontend build failed & pause & exit /b 1 ) +if not exist "%REPO%jeecgboot-vue3\dist\index.html" ( echo [ERROR] dist/index.html not found & pause & exit /b 1 ) + +echo [2/4] refresh web-dist folder ... +if exist "%WEBDIST%" rmdir /S /Q "%WEBDIST%" +mkdir "%WEBDIST%" +xcopy "%REPO%jeecgboot-vue3\dist\*" "%WEBDIST%\" /E /Y /I >nul + +echo [3/4] git add and commit web-dist ... +cd /d %REPO% +git add web-dist +git commit -m "frontend build dist update" + +echo [4/4] git push ... +git push +if errorlevel 1 ( echo [ERROR] git push failed & pause & exit /b 1 ) + +echo. +echo ===== FRONTEND BUILT AND PUSHED. Now run deploy-frontend.bat on the server. ===== +endlocal +pause diff --git a/deploy-frontend.bat b/deploy-frontend.bat new file mode 100644 index 00000000..4ba5b0eb --- /dev/null +++ b/deploy-frontend.bat @@ -0,0 +1,27 @@ +@echo off +setlocal +set SRC=D:\qhmes-src +set GIT="C:\Program Files\Git\cmd\git.exe" +set WEB=D:\qhmes\nginx-1.30.1\html\jeecg +set NGINX_DIR=D:\qhmes\nginx-1.30.1 + +echo [1/3] git pull ... +cd /d %SRC% +%GIT% pull +if errorlevel 1 ( echo [ERROR] git pull failed & pause & exit /b 1 ) +if not exist "%SRC%\web-dist\index.html" ( echo [ERROR] web-dist not found in repo, run build-frontend.bat first & pause & exit /b 1 ) + +echo [2/3] replace nginx frontend files ... +if exist "%WEB%" rmdir /S /Q "%WEB%" +mkdir "%WEB%" +xcopy "%SRC%\web-dist\*" "%WEB%\" /E /Y /I >nul +if errorlevel 1 ( echo [ERROR] copy failed & pause & exit /b 1 ) + +echo [3/3] reload nginx (ignore error if nginx not running) ... +cd /d %NGINX_DIR% +nginx.exe -s reload + +echo. +echo ===== FRONTEND DEPLOY DONE ===== +endlocal +pause