chore(frontend): 新增 npm run verify(typecheck+test+build) 与 watch 脚本;AGENTS.md 要求改前端后必跑 verify

This commit is contained in:
lhl
2026-09-12 18:40:29 +08:00
parent 0e56ef347e
commit e04b727acf
2 changed files with 7 additions and 1 deletions
+3
View File
@@ -46,6 +46,9 @@ npm test # 纯逻辑单测(node --test
``` ```
> 前端改动优先改 `frontend/src/*.ts`,再 `npm run build``?v=__ASSET_VER__` 依据文件 mtime 自动破缓存。 > 前端改动优先改 `frontend/src/*.ts`,再 `npm run build``?v=__ASSET_VER__` 依据文件 mtime 自动破缓存。
>
> **每次改动 `frontend/` 后必须运行 `npm run verify`typecheck → test → build**,确保入库产物 `src/genesis/server/static/chat.js` 与源码一致;提交时一并包含重建后的 `chat.js`。
> 开发期可用 `npm run watch` + `npm run typecheck:watch` 实现保存即重建/检查。
## 开发范式 ## 开发范式
+4 -1
View File
@@ -7,7 +7,10 @@
"build": "node esbuild.config.mjs", "build": "node esbuild.config.mjs",
"watch": "node esbuild.config.mjs --watch", "watch": "node esbuild.config.mjs --watch",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"test": "node --test tests/state.test.ts tests/ws.test.ts" "typecheck:watch": "tsc --noEmit --watch",
"test": "node --test tests/state.test.ts tests/ws.test.ts",
"test:watch": "node --test --watch tests/state.test.ts tests/ws.test.ts",
"verify": "npm run typecheck && npm test && npm run build"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^22.20.2", "@types/node": "^22.20.2",