|
|
пре 2 недеља | |
|---|---|---|
| .. | ||
| README.md | пре 2 недеља | |
| build.js | пре 2 недеља | |
| release.cjs | пре 2 недеља | |
本目录包含 Claude AI Installer 的构建和发布脚本。
npm run build:win # 仅构建 Windows
npm run build:mac # 仅构建 macOS
npm run build:linux # 仅构建 Linux
npm run build:all # 构建所有平台
只生成安装包到 release/ 目录,不修改版本号,不创建 Git tag。
npm run release:patch # 更新版本 → 构建 → 创建 tag
npm run release:minor # 次版本发布
npm run release:major # 主版本发布
完整流程:更新版本号 → 构建所有平台 → 生成发布说明 → 创建 Git tag。
简单来说:
build.js = 单纯构建release.js = 更新版本 + 构建 + 发布相关操作# 进入项目目录
cd ApqInstaller
# 安装依赖
npm install
# 构建当前平台
npm run build:win # Windows
npm run build:mac # macOS
npm run build:linux # Linux
npm run build:all # 所有平台
多平台构建脚本,用于编译和打包应用。
node scripts/build.js [选项]
| 选项 | 简写 | 说明 | 默认值 |
|---|---|---|---|
--platform |
-p |
目标平台: win, mac, linux, all |
当前平台 |
--arch |
-a |
目标架构: x64, arm64, all |
当前架构 |
--publish |
-P |
发布模式: always, onTag, never |
never |
--skip-build |
- | 跳过前端构建,仅打包 | - |
--help |
-h |
显示帮助信息 | - |
# 构建 Windows 版本
node scripts/build.js -p win
# 构建 macOS ARM64 版本
node scripts/build.js -p mac -a arm64
# 构建所有平台
node scripts/build.js -p all
# 跳过前端构建,仅打包
node scripts/build.js -p win --skip-build
自动化发布脚本,按以下顺序执行:
node scripts/release.js [版本] [选项]
| 参数 | 说明 | 示例 |
|---|---|---|
patch |
补丁版本 +1 | 0.0.1 → 0.0.2 |
minor |
次版本 +1 | 0.0.1 → 0.1.0 |
major |
主版本 +1 | 0.0.1 → 1.0.0 |
x.y.z |
指定版本号 | 1.2.3 |
| 选项 | 简写 | 说明 |
|---|---|---|
--tag |
-t |
创建 Git tag |
--push |
- | 推送 tag 到远程仓库 |
--platform |
-p |
指定平台 (逗号分隔) |
--dry-run |
- | 仅显示操作,不实际执行 |
--help |
-h |
显示帮助信息 |
# 更新补丁版本并构建
node scripts/release.js patch
# 设置版本为 1.0.0 并创建 tag
node scripts/release.js 1.0.0 --tag
# 更新次版本,仅构建 Windows 和 macOS
node scripts/release.js minor -p win,mac
# 完整发布流程:更新版本、构建、创建 tag、推送
node scripts/release.js patch --tag --push
# 预览发布操作(不实际执行)
node scripts/release.js patch --dry-run
在 package.json 中预定义了以下命令:
| 命令 | 说明 |
|---|---|
npm run build:win |
构建 Windows 版本 |
npm run build:mac |
构建 macOS 版本 |
npm run build:linux |
构建 Linux 版本 |
npm run build:all |
构建所有平台 |
| 命令 | 说明 |
|---|---|
npm run release |
发布(不更新版本) |
npm run release:patch |
发布补丁版本 + 创建 tag |
npm run release:minor |
发布次版本 + 创建 tag |
npm run release:major |
发布主版本 + 创建 tag |
构建完成后,安装包会输出到 release/ 目录:
| 格式 | 文件名 | 说明 |
|---|---|---|
| NSIS | Claude AI Installer-x.x.x-win-x64-nsis.exe |
安装程序 |
| Portable | Claude AI Installer-x.x.x-win-x64-portable.exe |
便携版 |
| 格式 | 文件名 | 说明 |
|---|---|---|
| DMG | Claude AI Installer-x.x.x-mac-x64-dmg.dmg |
Intel 版 |
| DMG | Claude AI Installer-x.x.x-mac-arm64-dmg.dmg |
Apple Silicon 版 |
| ZIP | Claude AI Installer-x.x.x-mac-x64-zip.zip |
Intel 压缩包 |
| ZIP | Claude AI Installer-x.x.x-mac-arm64-zip.zip |
Apple Silicon 压缩包 |
| 格式 | 文件名 | 说明 |
|---|---|---|
| AppImage | Claude AI Installer-x.x.x-linux-x64-AppImage.AppImage |
通用格式 |
| DEB | Claude AI Installer-x.x.x-linux-x64-deb.deb |
Debian/Ubuntu |
| RPM | Claude AI Installer-x.x.x-linux-x64-rpm.rpm |
Fedora/RHEL |
brew install --cask wine-stable)推荐使用 GitHub Actions 等 CI/CD 服务在各自平台的 runner 上构建:
# .github/workflows/build.yml 示例
jobs:
build:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- run: npm run build
运行发布命令:
npm run release:patch # 或 minor/major
检查 release/ 目录中的构建产物
手动推送(如果没有使用 --push):
git push && git push --tags
在 GitHub 创建 Release,上传构建产物
# 一键完成:更新版本 → 构建 → 创建 tag → 推送
node scripts/release.js patch --tag --push
npm installdist/ 和 dist-electron/ 目录确保以下图标文件存在:
public/icons/win/icon.icopublic/icons/mac/icon.icnspublic/icons/png/ (包含各尺寸 PNG)