# 背景
Electron 桌面安装包一直没打出来过(`release/` 为空,只有 web bundle)。
这次把它跑通,并验证了产物本身而不只是"文件存在"。
# 改动
**package.json 补齐 electron-builder 需要的元数据**(缺哪个就会让某个 target
直接失败,而报错不一定指向字段本身):
| 字段 | 位置 | 不填的后果 |
|---|---|---|
| `description` | 根 | deb 描述为空 |
| `author`(含 email) | 根 | deb 缺 maintainer |
| `homepage` | 根 | **deb 直接失败**:`Please specify project homepage` |
| `desktopName` | 根 | 窗口无法与 .desktop 关联(缺 `StartupWMClass`) |
| `linux.syncDesktopName` | `build.linux` | 同上 |
| `linux.synopsis` | `build.linux` | deb 描述只有一行 |
**新增 `client/electron/BUILD.md`**:记录构建命令、本机两个坑(见下)、
元数据清单、两个产物的实质区别、以及验证产物的方法。
# 两个产物(已在 release/,被 .gitignore 排除)
- `AgentMail-0.1.0.AppImage` 122MB,有效 x86-64 ELF、可执行位已设
- `agentmail-web_0.1.0_amd64.deb` 100MB,Maintainer/Homepage/Depends/两行 Description 齐全
**实测的实质区别(不是猜测,来自解包对照)**:
| | AppImage | deb |
|---|---|---|
| `.desktop` Exec | `AppRun --no-sandbox %U` | `/opt/AgentMail/agentmail-web %U` |
| Chromium 沙箱 | **禁用**(squashfs 无法保留 setuid 的 chrome-sandbox) | **启用**(postinst 按能力 `0755` 或 `4755`,并装 AppArmor 配置) |
| 卸载 | 删文件 | postrm 清理 alternatives / AppArmor / desktop-mime 库 |
结论写进文档:**对外分发优先 deb**。
# 验证(不只查存在性)
- AppImage:`--appimage-extract` 解包成功;`resources/app.asar` 8.5MB;
asar 清单里 `/dist/index.html`、`/dist/assets/{index,CalendarView}.js`、
`/dist/assets/{agentmail.svg,favicon.ico,apple-touch-icon.png}`、
`/electron/{main,preload}.cjs` 齐全;`index.html` 里 DOCTYPE 仍是大写
(即格式化器修复也进了包)
- deb:`dpkg-deb --info/--contents` 核对元数据与布局;7 档图标尺寸齐全;
读 postinst 确认沙箱策略与 AppArmor 安装
# 环境坑(已写进 BUILD.md)
**本网络下 `SHASUMS256.txt` 不可达**(直连 20s 超时、走代理也失败),
而 electron 构件本身 0.8s 就拿到(HTTP 206)。`@electron/get` 即使命中缓存
也会取校验文件 → 构建卡 10 分钟后失败。用命令行覆盖绕过:
npx electron-builder --linux -c.electronDownload.isVerifyChecksum=false
**刻意不写进 package.json** —— 那会让今后每次构建都跳过完整性校验。一次性绕过
网络限制不该固化成永久弱化的默认值。代价已写进文档(关校验后可被篡改镜像在
TLS 之外替换构件)。
# 待用户确认的占位值
- `author.email` 用了仓库自身的 git 身份 `jianf@noreply.localhost` —— 容器占位邮箱,
**不是真实联系地址**。项目里没有可用的真实邮箱,我没有编造一个。
- `homepage` 用 git remote 的唯一真实地址(内网 Gitea `192.168.2.106:3000`)。
两者对外分发前都应替换。
86 lines
2.5 KiB
JSON
86 lines
2.5 KiB
JSON
{
|
|
"name": "agentmail-web",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"description": "AgentMail —— 以邮件交互为统一范式的多智能体协作平台桌面客户端",
|
|
"author": {
|
|
"name": "JianFeeeee",
|
|
"email": "jianf@noreply.localhost"
|
|
},
|
|
"homepage": "http://192.168.2.106:3000/jianf/MailUI4Agents",
|
|
"desktopName": "AgentMail",
|
|
"type": "module",
|
|
"main": "electron/main.cjs",
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"dev:electron": "ELECTRON_START_URL=http://localhost:5173 electron electron/main.cjs",
|
|
"build": "vite build",
|
|
"build:win": "vite build && electron-builder --win",
|
|
"build:linux": "vite build && electron-builder --linux",
|
|
"preview": "vite preview",
|
|
"typecheck": "tsc --noEmit",
|
|
"test": "node test/markdown-xss.test.mjs && node test/narrow-layout.test.mjs && node test/theme.test.mjs && vitest run",
|
|
"test:narrow": "node test/manual/narrow-verify.mjs",
|
|
"test:wide": "node test/manual/wide-regression.mjs",
|
|
"test:components": "vitest run",
|
|
"test:watch": "vitest"
|
|
},
|
|
"dependencies": {
|
|
"lunar-javascript": "1.7.7",
|
|
"react": "^18.3.1",
|
|
"react-dom": "^18.3.1",
|
|
"react-markdown": "^9.0.1",
|
|
"remark-gfm": "^4.0.0",
|
|
"zustand": "^4.5.4"
|
|
},
|
|
"devDependencies": {
|
|
"@testing-library/dom": "10.4.1",
|
|
"@testing-library/jest-dom": "6.9.1",
|
|
"@testing-library/react": "16.3.0",
|
|
"@testing-library/user-event": "14.6.1",
|
|
"@types/react": "^18.3.3",
|
|
"@types/react-dom": "^18.3.0",
|
|
"@vitejs/plugin-react": "^4.3.1",
|
|
"autoprefixer": "^10.4.19",
|
|
"electron": "^44.2.0",
|
|
"electron-builder": "^26.15.3",
|
|
"jsdom": "26.1.0",
|
|
"postcss": "^8.4.39",
|
|
"tailwindcss": "^3.4.6",
|
|
"typescript": "^5.5.3",
|
|
"vite": "^5.3.4",
|
|
"vitest": "3.2.4"
|
|
},
|
|
"build": {
|
|
"appId": "xyz.jianfgit.agentmail",
|
|
"productName": "AgentMail",
|
|
"files": [
|
|
"dist/**/*",
|
|
"electron/**/*"
|
|
],
|
|
"directories": {
|
|
"buildResources": "src/icons",
|
|
"output": "release"
|
|
},
|
|
"win": {
|
|
"icon": "src/icons/icon.ico",
|
|
"target": [
|
|
{ "target": "nsis", "arch": ["x64"] }
|
|
]
|
|
},
|
|
"linux": {
|
|
"icon": "src/icons",
|
|
"target": [
|
|
{ "target": "AppImage", "arch": ["x64"] },
|
|
{ "target": "deb", "arch": ["x64"] }
|
|
],
|
|
"category": "Network",
|
|
"synopsis": "以邮件交互为统一范式的多智能体协作平台",
|
|
"syncDesktopName": true
|
|
},
|
|
"nsis": {
|
|
"oneClick": false,
|
|
"allowToChangeInstallationDirectory": true
|
|
}
|
|
}
|
|
} |