feat: 添加 Electron 自动构建工作流与更新通知功能#564
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
| "dev:electron": "node scripts/clean-electron.js && node scripts/build-gateway.js && vite --mode electron", | ||
| "build": "tsc -b && vite build", | ||
| "build:electron": "node scripts/clean-electron.js && node scripts/build-gateway.js && vite build --mode electron && node scripts/verify-electron-preload.js && electron-builder", | ||
| "build:electron": "node scripts/clean-electron.js && node scripts/build-gateway.js && vite build --mode electron && node scripts/verify-electron-preload.js && electron-builder --config electron-builder.config.cjs", |
There was a problem hiding this comment.
High: build:electron now builds neocode-gateway before running vite build --mode electron, but scripts/build-gateway.js compiles the gateway with -tags webembed. That means the packaged binary embeds whatever happens to already be in web/dist (or nothing, if dist/ is absent) instead of the renderer output produced later in this script. Any frontend changes in the same release can therefore be missing from the shipped Electron app. Build the renderer before the gateway, or rebuild the gateway after Vite finishes.
| arch: ['x64'], | ||
| }, | ||
| { | ||
| target: 'portable', |
There was a problem hiding this comment.
Medium: this adds a Windows portable artifact while web/electron/main.ts enables electron-updater for every production build. Portable builds are not supported by the standard NSIS/GitHub self-update flow, so that package will still check/download updates and show a restart prompt even though it cannot install them correctly. Either stop publishing the portable target on the auto-update channel or gate the updater off when running as a portable build.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
- 调整 build:electron 脚本顺序:先 vite build 生成 dist 产物,再编译网关, 保证 webembed 嵌入的是最新前端资源 - 在 setupAutoUpdater() 中检测 PORTABLE_EXECUTABLE_DIR,portable 模式下 跳过自动更新检查,避免 NSIS 不支持的更新流程误导用户 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
变更概述
本 PR 为 NeoCode 添加了 Electron 应用的自动化构建工作流,并实现了应用内更新通知功能。
主要变更
1. 自动构建工作流
.github/workflows/release-electron.ymlGitHub Actions 工作流2. Web 资源嵌入支持
internal/webassets/assets_embed.go和assets_noembed.goweb/dist_embed.go和dist_noembed.go3. Electron 应用增强
web/electron/main.ts:增强主进程功能web/electron/preload.ts:添加预加载脚本web/electron-builder.config.cjs:更新构建配置web/src/components/UpdateNotification.tsx:实现更新通知 UI 组件web/src/types/electron.d.ts:补充 TypeScript 类型定义4. 网关与 CLI 改进
internal/cli/gateway_commands.go:改进网关命令处理internal/cli/web_command.go:改进 Web 命令处理internal/gateway/network_server.go:增强网络服务器功能internal/gateway/static_files.go:改进静态文件服务5. 构建脚本更新
web/scripts/build-gateway.js:优化网关构建流程web/package.json和web/package-lock.json:依赖版本更新统计
测试建议