fix(service-party-app): 更新build-windows.bat支持clean选项

添加命令行参数支持:
- 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 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-28 20:17:27 -08:00
parent eb283389c4
commit 6b2b9e821e
1 changed files with 54 additions and 1 deletions

View File

@ -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