Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
deploy-to-vercel【部署与运维】Deploy a Next.js application to Vercel. Covers project linking, environment variables, preview deployments, custom domains, and production deployment configuration. Use when deploying a Next.js app for the first time, setting up preview deployments for pull requests, configuring custom domains, or managing environment variables in a production Vercel…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Next.js → Vercel w/ prod config.
npm run build
→ Build OK, no errs.
If err: Fix build before deploy. Common: TS errs, missing deps, bad imports.
npm install -g vercel
→ vercel cmd available, vercel --version works.
If err: Perm errs → sudo or user-local prefix. node --version.
# Login to Vercel
vercel login
# Deploy (first time: creates project)
vercel
# Follow prompts:
# - Set up and deploy? Y
# - Which scope? (select your account)
# - Link to existing project? N (for new projects)
# - Project name: my-app
# - Directory: ./
# - Override settings? N
→ Preview URL (e.g., https://my-app-xxx.vercel.app).
If err: vercel login fail → check net, try browser auth. Deploy fail → review build out. Clean env → all deps in package.json.
# Add environment variables
vercel env add DATABASE_URL production
vercel env add API_KEY production preview
# List environment variables
vercel env ls
Or dashboard: Project Settings > Environment Variables.
→ vercel env ls shows all vars in correct envs.
If err: Not at runtime → target env matches. Redeploy → existing deploys don't pick up new vars.
vercel --prod
→ Prod URL (e.g., https://my-app.vercel.app).
If err: vercel logs or dashboard. Common: missing prod env vars, build cmd diff from local.
https://vercel.com/new→ Dashboard shows repo connected, pushes trigger prod auto.
If err: Repo not in list → Vercel GH app access. GitHub Settings > Applications > Vercel.
vercel domains add my-domain.com
Or dashboard: Project Settings > Domains. Update DNS per Vercel.
→ vercel domains ls shows configured, after propagation (≤48h) resolves.
If err: "Invalid Configuration" → DNS matches exactly. dig my-domain.com or DNS checker.
vercel.json:
{
"framework": "nextjs",
"regions": ["iad1"],
"headers": [
{
"source": "/api/(.*)",
"headers": [
{ "key": "Cache-Control", "value": "no-store" }
]
}
]
}
→ vercel.json in root, next deploy picks up.
If err: Ignored → jq . vercel.json valid. Framework ver → some moved to next.config.ts.
npm run build OK locallypackage.json, not just global.env.local. Envs separate.package.json engines.vercelignore excludes.scaffold-nextjs-app — create app to deploysetup-tailwind-typescript — config styling pre-deployconfigure-git-repository — Git setup for auto-deploy