chore: 提交和推送前增加前端 TypeScript 检查

与 Docker 构建的 tsc -b 对齐,避免类型错误在服务器构建才暴露。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
yml2213
2026-09-10 11:45:35 +08:00
co-authored by Cursor
parent c1f4e7c7ae
commit 874a95dd6f
7 changed files with 92 additions and 6 deletions
+6 -2
View File
@@ -113,13 +113,17 @@ docker compose --profile test run --rm test
测试各自建 SQLite 内存库;根目录 `conftest.py` 兜底 `DATABASE_URL` / `APP_ENCRYPTION_KEY`,防止误连开发/生产库。迁移链冒烟见 `tests/test_migrations.py`。兑换、下单、支付属于写操作,默认用 mock 做契约测试,不打真实支付。
启用推送前门禁(Ruff + pytest):
启用提交/推送门禁(改过前端会跑 TypeScript,与 Docker `npm run build` 的 `tsc -b` 一致):
```bash
./scripts/install-git-hooks.sh
./dev.sh frontend-check # 单独跑前端 TypeScript
```
需要把 Pyright 也纳入时:`TYPECHECK=1 git push`。紧急绕过:`git push --no-verify` 或 `SKIP_TESTS=1 git push`。
- **pre-commit**:暂存的 Python 文件做 Ruff 格式检查;改了 `web/frontend/` 则跑 `tsc -b`
- **pre-push**:上述检查 + 全量 pytest
- Pyright 默认不开(噪音大):`TYPECHECK=1 git push`
- 紧急绕过:`git push --no-verify` 或 `SKIP_TESTS=1 git push`
## 技术栈