From 6b2b9e821eae0c9a413da96c0cb7909c97d1a830 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 28 Dec 2025 20:17:27 -0800 Subject: [PATCH] =?UTF-8?q?fix(service-party-app):=20=E6=9B=B4=E6=96=B0bui?= =?UTF-8?q?ld-windows.bat=E6=94=AF=E6=8C=81clean=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加命令行参数支持: - build-windows.bat 正常构建 - build-windows.bat clean 清理构建产物后重建 - build-windows.bat cleanall 完全清理(含node_modules)后重建 在其他电脑上首次编译时,建议使用: build-windows.bat cleanall 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../service-party-app/build-windows.bat | 55 ++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/backend/mpc-system/services/service-party-app/build-windows.bat b/backend/mpc-system/services/service-party-app/build-windows.bat index 73aa27fe..f2a45f1d 100644 --- a/backend/mpc-system/services/service-party-app/build-windows.bat +++ b/backend/mpc-system/services/service-party-app/build-windows.bat @@ -9,6 +9,40 @@ echo. cd /d "%~dp0" +:: Parse command line arguments +set "DO_CLEAN=0" +set "DO_CLEAN_ALL=0" + +if "%1"=="clean" set "DO_CLEAN=1" +if "%1"=="--clean" set "DO_CLEAN=1" +if "%1"=="-c" set "DO_CLEAN=1" +if "%1"=="cleanall" set "DO_CLEAN_ALL=1" +if "%1"=="--clean-all" set "DO_CLEAN_ALL=1" + +:: Clean all (includes node_modules) +if "%DO_CLEAN_ALL%"=="1" ( + echo [CLEAN] Performing full clean... + if exist "dist" rmdir /s /q "dist" + if exist "dist-electron" rmdir /s /q "dist-electron" + if exist "release" rmdir /s /q "release" + if exist "node_modules" rmdir /s /q "node_modules" + if exist "package-lock.json" del /q "package-lock.json" + if exist "node_modules\.cache" rmdir /s /q "node_modules\.cache" + echo [OK] Full clean completed + echo. +) + +:: Clean build artifacts only +if "%DO_CLEAN%"=="1" ( + echo [CLEAN] Cleaning build artifacts... + if exist "dist" rmdir /s /q "dist" + if exist "dist-electron" rmdir /s /q "dist-electron" + if exist "release" rmdir /s /q "release" + if exist "node_modules\.cache" rmdir /s /q "node_modules\.cache" + echo [OK] Clean completed + echo. +) + :: Check Node.js where node >nul 2>nul if %errorlevel% neq 0 ( @@ -56,7 +90,15 @@ echo [2/4] Installing npm dependencies... echo ============================================ if exist "node_modules" ( - echo Dependencies exist, skipping install + if "%DO_CLEAN_ALL%"=="0" ( + echo Dependencies exist, skipping install + ) else ( + call npm install + if %errorlevel% neq 0 ( + echo [ERROR] npm install failed + goto :error + ) + ) ) else ( call npm install if %errorlevel% neq 0 ( @@ -102,6 +144,14 @@ if exist "release" ( dir /b release\*.exe 2>nul ) +echo. +echo ============================================ +echo Usage Tips +echo ============================================ +echo. +echo build-windows.bat Normal build +echo build-windows.bat clean Clean and rebuild +echo build-windows.bat cleanall Full clean (delete node_modules) and rebuild echo. echo Press any key to exit... pause >nul @@ -111,5 +161,8 @@ exit /b 0 echo. echo Build failed. Please check error messages. echo. +echo If you encounter module/type errors, try: +echo build-windows.bat cleanall +echo. pause exit /b 1