| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- @echo off
- chcp 65001 >nul 2>&1
- :: ============================================
- :: Claude AI Installer Windows 构建脚本
- :: Build script for Windows (NSIS + Portable)
- :: 此脚本作为 scripts/build.js 的简单入口
- :: ============================================
- :: 切换到脚本所在目录
- cd /d "%~dp0"
- :: 检查是否请求帮助
- if /i "%~1"=="--help" goto :show_help
- if /i "%~1"=="-h" goto :show_help
- :: 检查 Node.js
- where node >nul 2>&1
- if errorlevel 1 (
- echo [91mx[0m 未找到 Node.js,请先安装 Node.js
- pause
- exit /b 1
- )
- :: 检查 node_modules
- if not exist "node_modules" (
- echo [93m![0m 未找到 node_modules,正在安装依赖...
- call npm install
- if errorlevel 1 (
- echo [91mx[0m 安装依赖失败
- pause
- exit /b 1
- )
- )
- :: 转换参数并调用 Node.js 脚本
- :: 将 bat 参数映射到 build.js 参数
- set "NODE_ARGS=-p win"
- :parse_args
- if "%~1"=="" goto :run_build
- if /i "%~1"=="--skip-build" set "NODE_ARGS=%NODE_ARGS% --skip-build" & shift & goto :parse_args
- if /i "%~1"=="-s" set "NODE_ARGS=%NODE_ARGS% --skip-build" & shift & goto :parse_args
- if /i "%~1"=="--skip-typecheck" set "NODE_ARGS=%NODE_ARGS% --skip-typecheck" & shift & goto :parse_args
- if /i "%~1"=="--arch" set "NODE_ARGS=%NODE_ARGS% --arch %~2" & shift & shift & goto :parse_args
- if /i "%~1"=="-a" set "NODE_ARGS=%NODE_ARGS% --arch %~2" & shift & shift & goto :parse_args
- shift
- goto :parse_args
- :run_build
- echo.
- echo [96m^> 调用 Node.js 构建脚本...[0m
- echo [94mi[0m 执行: node scripts/build.js %NODE_ARGS%
- echo.
- call node scripts/build.js %NODE_ARGS%
- if errorlevel 1 (
- echo.
- echo [91mx[0m 构建失败!
- echo.
- pause
- exit /b 1
- )
- echo.
- pause
- goto :eof
- :: ============================================
- :: 显示帮助信息
- :: ============================================
- :show_help
- echo.
- echo Claude AI Installer Windows 构建脚本
- echo.
- echo 用法:
- echo build-win.bat [参数]
- echo.
- echo 参数:
- echo --skip-build, -s 跳过前端构建,仅执行打包
- echo --skip-typecheck 跳过 TypeScript 类型检查
- echo --arch, -a ^<arch^> 目标架构: x64, arm64, all (默认: x64)
- echo --help, -h 显示此帮助信息
- echo.
- echo 示例:
- echo build-win.bat 完整构建
- echo build-win.bat -s 仅打包
- echo build-win.bat -a all 构建所有架构
- echo build-win.bat --skip-typecheck 跳过类型检查
- echo.
- echo 输出:
- echo release\Claude AI Installer-x.x.x-win-x64-nsis.exe (NSIS 安装程序)
- echo release\Claude AI Installer-x.x.x-win-x64-portable.exe (便携版)
- echo.
- echo 注意: 此脚本调用 scripts/build.js 执行实际构建
- echo.
- goto :eof
|