Skip to content

Commit 8cd9948

Browse files
authored
Rebuild bundled backend before packaging (#8)
* fix: stabilize forwarded message timestamps * fix lint * Simplify Feishu result cards * fix lint * Rebuild bundled backend before packaging
1 parent d5b2d94 commit 8cd9948

4 files changed

Lines changed: 32 additions & 2 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ build-backend:
3737

3838
build-electron:
3939
@echo "构建Electron应用..."
40-
cd $(ELECTRON_DIR) && npm run package
40+
cd $(ELECTRON_DIR) && SKIP_BACKEND_BUILD=1 npm run package
4141
@echo "Electron应用构建完成"
4242

4343
package-dmg: build-backend build-electron
4444
@echo "打包DMG文件..."
45-
cd $(ELECTRON_DIR) && npm run make
45+
cd $(ELECTRON_DIR) && SKIP_BACKEND_BUILD=1 npm run make
4646
@if [ -f "$(DMG_OUTPUT)" ]; then \
4747
echo "DMG文件生成成功: $(DMG_OUTPUT)"; \
4848
ls -lh "$(DMG_OUTPUT)"; \

docs/todo.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,9 @@
174174
- 测试验证:Python 进程 PID 变化确认热重载工作正常
175175
- 预计工作量:2-3小时(实际完成时间:约30分钟)
176176
- 难度评估:⭐⭐⭐☆☆(中等偏易)
177+
178+
- [x] **修复 macOS App 创建任务的 Feishu 卡片通知** — 排查 UI 创建任务的结果通知是否绕过当前 Feishu 渲染链路,并统一到优化后的卡片发送逻辑
179+
- ✅ 已完成:Electron `package/make` 现在会在打包前自动重建 `taskboard-electron/resources/taskboard`,避免 macOS App 继续携带旧的 Python backend
180+
- ✅ 已完成:新增 `taskboard-electron/scripts/build-backend.mjs`,统一复用 `make build-backend` 构建 bundled backend;`Makefile` 同步避免重复构建
181+
- ✅ 验证:`uv run pytest tests/test_feishu_message_rendering.py tests/test_feishu_forwarded_messages.py -q` 通过,`19 passed`
182+
- ✅ 验证:`node taskboard-electron/scripts/build-backend.mjs` 通过,并生成新的 `taskboard-electron/resources/taskboard`

taskboard-electron/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"main": ".vite/build/main.js",
77
"private": true,
88
"scripts": {
9+
"prepackage": "node scripts/build-backend.mjs",
10+
"premake": "node scripts/build-backend.mjs",
911
"start": "electron-forge start",
1012
"package": "electron-forge package",
1113
"make": "electron-forge make",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { spawnSync } from "node:child_process";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
5+
if (process.env.SKIP_BACKEND_BUILD === "1") {
6+
console.log("[build-backend] SKIP_BACKEND_BUILD=1, skipping bundled backend rebuild");
7+
process.exit(0);
8+
}
9+
10+
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
11+
const projectRoot = path.resolve(scriptDir, "..", "..");
12+
13+
console.log("[build-backend] Rebuilding bundled Python backend...");
14+
15+
const result = spawnSync("make", ["build-backend"], {
16+
cwd: projectRoot,
17+
stdio: "inherit",
18+
});
19+
20+
if (result.status !== 0) {
21+
process.exit(result.status ?? 1);
22+
}

0 commit comments

Comments
 (0)