deployment-verification
开发环境部署到生产环境前的验证清单与最佳实践,重点关注 Monorepo 依赖管理与环境一致性。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
开发环境部署到生产环境前的验证清单与最佳实践,重点关注 Monorepo 依赖管理与环境一致性。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
通用代码质量检查,包括语法错误、TypeScript 类型检查和 Prettier 代码美化。在提交代码前、完成功能开发后、或用户要求检查代码质量时使用。
Use when designing data structures, database schemas, state management, or data relationships - covers single source of truth, complete data flow thinking
Use when integrating with external APIs, third-party SDKs, or libraries - covers verification workflow before writing any integration code
Implements filterable, paginated list pages with URL as single source of truth (nuqs) and TanStack Query to avoid duplicate requests and support shareable links. Use when building list pages with filters, pagination, URL-synced state, or when fixing multiple requests on page change.
Use when working with Polymarket API - profiles, activities, events, markets endpoints
规范 Polymarket 的 Privy + Safe + Builder + CLOB 集成流程,覆盖新老用户分支、三次签名、授权批处理、安全边界与排障步骤。Use when implementing or debugging Privy embedded wallet, Safe deployment, builder relayer, remote signing, CLOB api credentials, token approvals, or builder attribution order flow.
| name | deployment-verification |
| description | 开发环境部署到生产环境前的验证清单与最佳实践,重点关注 Monorepo 依赖管理与环境一致性。 |
用于指导从本地开发环境部署到生产环境(如 Railway, Vercel)时的验证步骤,特别针对 Monorepo 架构下的常见问题。
当进行以下操作时,请参考此规范:
在 Monorepo (TurboRepo/PNPM) 中,最常见的部署错误是幽灵依赖 (Phantom Dependencies)。
本地开发正常运行,但线上构建失败,报错 Cannot find module 'xxx'。
本地包管理器(尤其是 PNPM 在宽松模式下或通过 Workspace)可能允许代码访问未在当前 package 的 package.json 中显式声明的依赖(例如兄弟 package 的依赖)。
生产构建通常是纯净环境(Clean Install),严格遵循 package.json,因此构建失败。
import 的所有第三方库是否都列在当前 apps/*/package.json 或 packages/*/package.json 的 dependencies 中。pnpm-lock.yaml 是最新的且已提交。在本地模拟严格环境进行验证:
# 清理本地所有 node_modules (慎用,需重新安装)
pnpm clean
# 或者手动删除
rm -rf node_modules apps/*/node_modules packages/*/node_modules
# 重新安装(确保 lockfile 一致)
pnpm install --frozen-lockfile
# 针对特定应用构建
pnpm build --filter <app-name>
确保本地开发环境与生产容器环境的基础配置一致。
生产环境(如 Railway, Vercel)通常有默认的 Node 版本(往往较旧)。
.nvmrc 指定版本(如 20)。package.json 中限制版本:
"engines": {
"node": ">=20.9.0"
}
package.json 中锁定包管理器版本:
"packageManager": "pnpm@9.x.x"
package-lock.json (npm) 和 pnpm-lock.yaml。确保只有 pnpm-lock.yaml 存在。检查 turbo.json 和 package.json 中的构建脚本。
NEXT_PUBLIC_API_URL)?如果是,确保在构建时能获取到(Build Arguments)。tsc 类型检查?Module not found: Can't resolve 'xyz'修复: 在报错的子项目中显式安装该依赖。
pnpm add xyz --filter <project-name>
lockfile is not up to date修复: 本地重新安装并更新 lockfile。
pnpm install
# 提交变更
git add pnpm-lock.yaml
错误: You are using Node.js 18.x.x. For Next.js, Node.js version ">=20.9.0" is required.
修复: 添加 .nvmrc 并推送到远程。
错误: ERR_PNPM_PEER_DEP_ISSUES
修复: 在根目录 package.json 使用 pnpm.overrides 强制版本统一。
"pnpm": {
"overrides": {
"react": "19.0.0",
"react-dom": "19.0.0"
}
}