修复隐藏缓存目录下载和响应收尾,使用原生助手校验安装包并确认交接。 补齐真实静默升级、便携版及中文路径验收,并按现行设备和科目授权契约更新回归。 服务端安装时生成独立密钥,覆盖升级保留既有配置;补齐安装包副本验证说明。
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
/**
|
|
* 主进程 / preload 构建:esbuild 打包为 CommonJS。
|
|
* - external: electron(由 Electron 运行时提供)
|
|
* - @classhelper/shared 会被内联打包(ESM 源码 -> CJS 产物)
|
|
*/
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { build } from 'esbuild';
|
|
import { buildUpdateHelper } from './build-update-helper.mjs';
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
buildUpdateHelper(path.join(root, 'dist/main/update-helper.exe'));
|
|
|
|
const shared = {
|
|
bundle: true,
|
|
platform: 'node',
|
|
target: 'node20',
|
|
format: 'cjs',
|
|
sourcemap: false,
|
|
external: ['electron'],
|
|
logLevel: 'warning',
|
|
define: {
|
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'production'),
|
|
},
|
|
};
|
|
|
|
await build({
|
|
...shared,
|
|
entryPoints: [path.join(root, 'src/main/index.ts')],
|
|
outfile: path.join(root, 'dist/main/index.js'),
|
|
});
|
|
|
|
await build({
|
|
...shared,
|
|
entryPoints: [path.join(root, 'src/preload/index.ts')],
|
|
outfile: path.join(root, 'dist/preload/index.js'),
|
|
});
|
|
|
|
// 灵动岛窗口的独立 preload(只暴露状态订阅与操作转发)
|
|
await build({
|
|
...shared,
|
|
entryPoints: [path.join(root, 'src/preload/island.ts')],
|
|
outfile: path.join(root, 'dist/preload/island.js'),
|
|
});
|
|
|
|
console.log('[build:main] dist/main/index.js、dist/preload/index.js、dist/preload/island.js 构建完成');
|