fix: pre-commit 任务容错 + gitleaks 钩子 + pnpm 构建门禁

- _tasks 的 pre-commit install 改为容错:未装时跳过而非让 copier 失败
- .pre-commit-config 增加 gitleaks 钩子(git-workflow/security 规则均已声明)
- 新增 frontend/pnpm-workspace.yaml 的 allowBuilds: esbuild,解决 pnpm 11
  ERR_PNPM_IGNORED_BUILDS 致 install 非零退出而中断生成的问题

端到端验证:copier 退出 0,git/uv.lock/pnpm-lock/node_modules 齐全,
verify.sh 零失败。
This commit is contained in:
baozaotumao
2026-06-01 21:38:12 -07:00
parent 2a959f2e61
commit 4c7dbb56eb
3 changed files with 16 additions and 1 deletions
+6
View File
@@ -11,6 +11,12 @@ repos:
- id: check-added-large-files
- id: detect-private-key
# 密钥扫描(防密钥误入库,配合 detect-private-key
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks
# 提交信息规范(Conventional Commits
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.4.0
@@ -0,0 +1,5 @@
# pnpm 10+ 默认拦截依赖的构建脚本(供应链安全)。
# allowBuilds 显式放行确需构建的包,避免 ERR_PNPM_IGNORED_BUILDS 致 install 非零退出。
# pnpm 11 用 allowBuilds 取代已废弃的 onlyBuiltDependencies。
allowBuilds:
esbuild: true