Files
ele-HeiXiu/build/electron-builder.js
YoungestSongMo 337d6c1205 feat: 构建系统重构 + VCHSM 架构迁移 + 右键菜单修复 + 尺寸参数统一
## 构建、打包与分发系统重构 (build/)

- 构建系统收敛至 build/ 目录:build.mjs + electron-builder.js + 6 个脚本

- electron-builder 配置从 package.json 提取为 build/electron-builder.js

- 新增 --edition (personal/enterprise) 和 --channel (stable/beta/alpha) 参数

- OSS 路径按渠道隔离

- 新增 pre-build-check.mjs:Git/CHANGELOG/版本/环境变量校验

- 新增 bump-version.mjs:版本号管理 + CHANGELOG 自动生成

- updater.ts 发送 channel/edition/deviceFingerprint

- 新增 src/shared/utils/rollout.ts 灰度测试工具

- 新增 10 条 NPM 脚本

## VCHSM 五层架构迁移

- 7 个业务模块 + ~500 处导入路径同步

## 修复

- MediaCardContextMenu 改用共享 ContextMenu 组件

- ComboBox 尺寸参数显示统一 (size-format.ts)

## 文档

- UpdateA.md / build/README.md / README.md / .env.example 更新

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-29 18:41:07 +08:00

79 lines
2.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ============================================================
// electron-builder 配置
//
// 从 package.json "build" 字段提取,通过环境变量动态注入参数。
// build.mjs 负责设置 HEIXIU_* 环境变量后调用 electron-builder。
//
// 用法:
// HEIXIU_EDITION=enterprise HEIXIU_CHANNEL=beta npx electron-builder --win --config build/electron-builder.js
// ============================================================
import { readFileSync } from 'node:fs';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = join(__dirname, '..');
const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'));
const edition = process.env.HEIXIU_EDITION || 'personal';
const channel = process.env.HEIXIU_CHANNEL || 'stable';
const releaseDirName = process.env.HEIXIU_RELEASE_DIR_NAME || pkg.version;
const editionLabel = edition === 'enterprise' ? '企业版' : '';
const productName = editionLabel
? `船长·HeiXiu·${editionLabel}`
: '船长·HeiXiu';
/** @type {import('electron-builder').Configuration} */
const config = {
appId: edition === 'enterprise'
? 'com.heixiu.enterprise'
: 'com.heixiu.electron',
productName,
asar: true,
directories: {
output: `release/${releaseDirName}`,
},
files: [
'dist',
'dist-electron',
],
electronDownload: {
mirror: 'https://npmmirror.com/mirrors/electron/',
},
// generic provider 仅作为 electron-updater 的 fallback
// 实际版本检查通过自定义 HeiXiuProvider → API
publish: {
provider: 'generic',
url: 'https://update.heixiu.com',
},
win: {
icon: 'src/assets/logo/heixiu.ico',
target: [{ target: 'NSIS', arch: ['x64'] }],
artifactName: '${productName}-Windows-${version}-Setup.${ext}',
},
mac: {
icon: 'src/assets/logo/heixiu.icns',
target: ['dmg'],
artifactName: '${productName}-Mac-${version}-Installer.${ext}',
},
linux: {
icon: 'src/assets/logo/HX.png',
target: ['AppImage'],
artifactName: '${productName}-Linux-${version}.${ext}',
},
nsis: {
oneClick: false,
perMachine: false,
allowToChangeInstallationDirectory: true,
deleteAppDataOnUninstall: false,
differentialPackage: true,
installerIcon: 'src/assets/logo/heixiu.ico',
uninstallerIcon: 'src/assets/logo/heixiu.ico',
},
};
export default config;