feat(service-party-app): 添加 Windows 一键编译脚本

添加 build-windows.bat 脚本,支持:
- 检查 Node.js 和 Go 环境
- 编译 TSS 子进程 (tss-party.exe)
- 安装 npm 依赖
- 编译 Electron 应用

使用方法: 双击运行 build-windows.bat

🤖 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 07:07:43 -08:00
parent 1908544698
commit 8733e49735
1 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,119 @@
@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
echo ============================================
echo Service Party App - Windows 编译脚本
echo ============================================
echo.
cd /d "%~dp0"
:: 检查 Node.js
where node >nul 2>nul
if %errorlevel% neq 0 (
echo [错误] 未找到 Node.js请先安装 Node.js 18+
echo 下载地址: https://nodejs.org/
goto :error
)
:: 检查 Go
where go >nul 2>nul
if %errorlevel% neq 0 (
echo [错误] 未找到 Go请先安装 Go 1.21+
echo 下载地址: https://go.dev/dl/
goto :error
)
:: 显示版本信息
echo [信息] Node.js 版本:
node --version
echo [信息] Go 版本:
go version
echo.
:: 步骤 1: 编译 TSS 子进程
echo ============================================
echo [1/4] 编译 TSS 子进程 (Go)...
echo ============================================
cd tss-party
if not exist "..\bin\win32-x64" mkdir "..\bin\win32-x64"
echo 正在编译 tss-party.exe...
go build -ldflags="-s -w" -o ..\bin\win32-x64\tss-party.exe .
if %errorlevel% neq 0 (
echo [错误] TSS 子进程编译失败
goto :error
)
echo [成功] tss-party.exe 已生成
cd ..
echo.
:: 步骤 2: 安装依赖
echo ============================================
echo [2/4] 安装 npm 依赖...
echo ============================================
if exist "node_modules" (
echo 依赖已存在,跳过安装 (如需重新安装请删除 node_modules 文件夹)
) else (
call npm install
if %errorlevel% neq 0 (
echo [错误] npm install 失败
goto :error
)
)
echo [成功] 依赖安装完成
echo.
:: 步骤 3: 创建图标 (如果不存在)
echo ============================================
echo [3/4] 检查资源文件...
echo ============================================
if not exist "build" mkdir "build"
if not exist "build\icon.ico" (
echo [警告] 未找到 build\icon.ico将使用默认图标
echo 如需自定义图标,请将 icon.ico (256x256) 放入 build 文件夹
)
echo.
:: 步骤 4: 编译 Electron 应用
echo ============================================
echo [4/4] 编译 Windows 应用...
echo ============================================
:: 编译 TypeScript 和 Vite
echo 正在编译前端代码...
call npm run build:win
if %errorlevel% neq 0 (
echo [错误] 应用编译失败
goto :error
)
echo.
echo ============================================
echo 编译完成!
echo ============================================
echo.
echo 输出目录: %cd%\release\
echo.
:: 列出生成的文件
if exist "release" (
echo 生成的文件:
dir /b release\*.exe 2>nul
)
echo.
echo 按任意键退出...
pause >nul
exit /b 0
:error
echo.
echo 编译失败,请检查错误信息
echo.
pause
exit /b 1