refactor(desktop): 优化 Electrobun 构建配置

- 从 package.json 动态读取版本号替代硬编码
- 启用所有平台的 CEF 捆绑
- 将构建目标从配置文件移至 CLI 参数
- 启用 asar 打包并为 dev 脚本添加 --env=dev 标志
This commit is contained in:
2026-02-08 02:38:37 +08:00
parent 7450c685d3
commit b8d38872ad
2 changed files with 7 additions and 6 deletions

View File

@@ -1,27 +1,28 @@
import type { ElectrobunConfig } from 'electrobun' import type { ElectrobunConfig } from 'electrobun'
import { version } from './package.json'
export default { export default {
app: { app: {
name: 'Desktop', name: 'Desktop',
identifier: 'com.furtherverse.desktop', identifier: 'com.furtherverse.desktop',
version: '1.0.0', version,
}, },
build: { build: {
useAsar: true,
bun: { bun: {
entrypoint: 'src/bun/index.ts', entrypoint: 'src/bun/index.ts',
}, },
copy: { copy: {
'../server/.output': 'server-output', '../server/.output': 'server-output',
}, },
targets: 'win-x64',
linux: { linux: {
bundleCEF: true, bundleCEF: true,
}, },
mac: { mac: {
bundleCEF: false, bundleCEF: true,
}, },
win: { win: {
bundleCEF: false, bundleCEF: true,
}, },
}, },
} satisfies ElectrobunConfig } satisfies ElectrobunConfig

View File

@@ -4,8 +4,8 @@
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"build": "electrobun build --env=stable", "build": "electrobun build --env=stable --targets=win-x64",
"dev": "electrobun build && electrobun dev", "dev": "electrobun build --env=dev && electrobun dev",
"fix": "biome check --write", "fix": "biome check --write",
"typecheck": "tsc --noEmit" "typecheck": "tsc --noEmit"
}, },