release-win.bat 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. @echo off
  2. chcp 65001 >nul 2>&1
  3. :: ============================================
  4. :: Claude AI Installer Windows 发布脚本
  5. :: Release script for Windows
  6. :: 此脚本作为 scripts/release.js 的简单入口
  7. :: ============================================
  8. :: 切换到脚本所在目录
  9. cd /d "%~dp0"
  10. :: 检查是否请求帮助
  11. if /i "%~1"=="--help" goto :show_help
  12. if /i "%~1"=="-h" goto :show_help
  13. :: 检查 Node.js
  14. where node >nul 2>&1
  15. if errorlevel 1 (
  16. echo [x] 未找到 Node.js,请先安装 Node.js
  17. pause
  18. exit /b 1
  19. )
  20. :: 检查 node_modules
  21. if not exist "node_modules" (
  22. echo [!] 未找到 node_modules,正在安装依赖...
  23. call npm install
  24. if errorlevel 1 (
  25. echo [x] 安装依赖失败
  26. pause
  27. exit /b 1
  28. )
  29. )
  30. :: 转换参数并调用 Node.js 脚本
  31. :: release.js 在 Windows 上已默认只构建 win 平台
  32. :: 默认版本类型为 patch
  33. set "NODE_ARGS=patch"
  34. :parse_args
  35. if "%~1"=="" goto :run_release
  36. if /i "%~1"=="patch" set "NODE_ARGS=patch" & shift & goto :parse_args
  37. if /i "%~1"=="minor" set "NODE_ARGS=minor" & shift & goto :parse_args
  38. if /i "%~1"=="major" set "NODE_ARGS=major" & shift & goto :parse_args
  39. if /i "%~1"=="--dry-run" set "NODE_ARGS=%NODE_ARGS% --dry-run" & shift & goto :parse_args
  40. if /i "%~1"=="--platform" set "NODE_ARGS=%NODE_ARGS% --platform %~2" & shift & shift & goto :parse_args
  41. if /i "%~1"=="-p" set "NODE_ARGS=%NODE_ARGS% --platform %~2" & shift & shift & goto :parse_args
  42. shift
  43. goto :parse_args
  44. :run_release
  45. echo.
  46. echo ^> 调用 Node.js 发布脚本...
  47. echo 执行: node scripts/release.cjs %NODE_ARGS%
  48. echo.
  49. call node scripts/release.cjs %NODE_ARGS%
  50. if errorlevel 1 (
  51. echo.
  52. echo [x] 发布失败!
  53. echo.
  54. pause
  55. exit /b 1
  56. )
  57. echo.
  58. pause
  59. goto :eof
  60. :: ============================================
  61. :: 显示帮助信息
  62. :: ============================================
  63. :show_help
  64. echo.
  65. echo Claude AI Installer Windows 发布脚本
  66. echo.
  67. echo 用法:
  68. echo release-win.bat [版本类型] [参数]
  69. echo.
  70. echo 版本类型:
  71. echo patch 补丁版本 +1 (默认, 如: 0.0.1 -^> 0.0.2)
  72. echo minor 次版本 +1 (如: 0.0.1 -^> 0.1.0)
  73. echo major 主版本 +1 (如: 0.0.1 -^> 1.0.0)
  74. echo.
  75. echo 参数:
  76. echo --dry-run 仅显示操作,不实际执行
  77. echo --platform, -p 指定平台 (逗号分隔): win,mac,linux
  78. echo --help, -h 显示此帮助信息
  79. echo.
  80. echo 示例:
  81. echo release-win.bat 更新 patch 版本并构建
  82. echo release-win.bat minor 更新 minor 版本并构建
  83. echo release-win.bat --dry-run 预览发布操作
  84. echo.
  85. echo 输出:
  86. echo release\Claude-AI-Installer-x.x.x-win-x64-setup.exe (NSIS 安装程序)
  87. echo release\Claude-AI-Installer-x.x.x-win-x64.msi (MSI 安装程序)
  88. echo release\Claude-AI-Installer-x.x.x-win-x64-portable.exe (便携版,无需安装)
  89. echo.
  90. echo 注意: 此脚本调用 scripts/release.cjs 执行实际发布
  91. echo Windows 上默认只构建 win 平台
  92. echo.
  93. goto :eof