| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- @echo off
- chcp 65001 >nul 2>&1
- :: ============================================
- :: Claude AI Installer Windows 发布脚本
- :: Release script for Windows
- :: 此脚本作为 scripts/release.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 脚本
- :: release.js 在 Windows 上已默认只构建 win 平台
- :: 默认版本类型为 patch
- set "NODE_ARGS=patch"
- :parse_args
- if "%~1"=="" goto :run_release
- if /i "%~1"=="patch" set "NODE_ARGS=patch" & shift & goto :parse_args
- if /i "%~1"=="minor" set "NODE_ARGS=minor" & shift & goto :parse_args
- if /i "%~1"=="major" set "NODE_ARGS=major" & shift & goto :parse_args
- if /i "%~1"=="--tag" set "NODE_ARGS=%NODE_ARGS% --tag" & shift & goto :parse_args
- if /i "%~1"=="-t" set "NODE_ARGS=%NODE_ARGS% --tag" & shift & goto :parse_args
- if /i "%~1"=="--push" set "NODE_ARGS=%NODE_ARGS% --push" & shift & goto :parse_args
- if /i "%~1"=="--dry-run" set "NODE_ARGS=%NODE_ARGS% --dry-run" & shift & goto :parse_args
- if /i "%~1"=="--platform" set "NODE_ARGS=%NODE_ARGS% --platform %~2" & shift & shift & goto :parse_args
- if /i "%~1"=="-p" set "NODE_ARGS=%NODE_ARGS% --platform %~2" & shift & shift & goto :parse_args
- shift
- goto :parse_args
- :run_release
- echo.
- echo [96m^> 调用 Node.js 发布脚本...[0m
- echo [94mi[0m 执行: node scripts/release.js %NODE_ARGS%
- echo.
- call node scripts/release.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 release-win.bat [版本类型] [参数]
- echo.
- echo 版本类型:
- echo patch 补丁版本 +1 (默认, 如: 0.0.1 -^> 0.0.2)
- echo minor 次版本 +1 (如: 0.0.1 -^> 0.1.0)
- echo major 主版本 +1 (如: 0.0.1 -^> 1.0.0)
- echo.
- echo 参数:
- echo --tag, -t 创建 Git tag
- echo --push 推送 tag 到远程仓库 (需要先指定 --tag)
- echo --dry-run 仅显示操作,不实际执行
- echo --platform, -p 指定平台 (逗号分隔): win,mac,linux
- echo --help, -h 显示此帮助信息
- echo.
- echo 示例:
- echo release-win.bat 更新 patch 版本并构建
- echo release-win.bat minor 更新 minor 版本并构建
- echo release-win.bat patch --tag 更新版本、构建并创建 tag
- echo release-win.bat --tag --push 更新版本、构建、创建 tag 并推送
- echo release-win.bat --dry-run 预览发布操作
- echo.
- echo 输出:
- echo release\Claude-AI-Installer-x.x.x-win-x64-setup.exe (NSIS 安装程序)
- echo release\Claude-AI-Installer-x.x.x-win-x64.exe (便携版)
- echo.
- echo 注意: 此脚本调用 scripts/release.js 执行实际发布
- echo Windows 上默认只构建 win 平台
- echo.
- goto :eof
|