2026-01-11-【架构】代码审查

定位问题

  • ci 阶段执行postinstall
1
2
3
"scripts": {
"postinstall": "pnpm audit --audit-level high"
}

定位“罪魁祸首”(找出关键包)

  • 运行以下命令获取更清晰的结构:
    pnpm audit --json > audit.json

  • 或者使用过滤参数,优先处理生产环境的致命漏洞:
    pnpm audit --audit-level critical --prod

  • 抓大放小
    pnpm audit --audit-level critical --json > audit.json
    pnpm audit --audit-level high --json > audit.json

解决问题

  • 利用 package.json 中 pnpm 配置
1
2
3
4
5
6
"pnpm": {
"overrides": {
"cross-spawn": ">=7.0.5",
"micromatch": ">=4.0.8",
}
}

2026-01-11-【架构】代码审查
https://zhangyingxuan.github.io/2026-01-11-【架构】代码审查/
作者
blowsysun
许可协议