Skip to content

ci: add production build check and lighten pre-commit hooks - #988

Merged
Yeom-JinHo merged 1 commit into
magicuidesign:mainfrom
Yeom-JinHo:ci/build-check-and-lighter-hooks
Jul 19, 2026
Merged

ci: add production build check and lighten pre-commit hooks#988
Yeom-JinHo merged 1 commit into
magicuidesign:mainfrom
Yeom-JinHo:ci/build-check-and-lighter-hooks

Conversation

@Yeom-JinHo

Copy link
Copy Markdown
Member

Summary

  • CI: Add a build job to code-check.yml — PRs that break the Next.js production build now fail CI. No secrets needed (all env reads in the build path are defensive), so fork PRs build identically. Caches apps/www/.next/cache, uses setup-node@v4 + node-version-file: .nvmrc. A workflow-level concurrency group cancels superseded runs on rapid pushes.
  • Hooks: Rework lefthook.yml around fast, staged-only pre-commit (~30–120s → ~2–10s per commit):
    • lint/format run directly on staged files instead of the whole project
    • registry build uses the www-scoped script (the root script also ran a hidden full-project lint+format) and stages generated artifacts by explicit path instead of git add --all
    • full typecheck moves from pre-commit to pre-push
  • Guard: Generated registry JSON added to .prettierignore so the format hook can never reformat build:registry output away from its JSON.stringify form (which would trip the registry-drift CI check).

Why the build job matters

While validating this change on a fork that predated #979, the new job immediately caught the tweet-card prerender regression (TypeError: c is not iterable) that used to slip through CI — exactly the class of failure this check gates. Verified green against current main (full 381-page prerender, ~5 min cold / ~2–4 min with warm cache).

Contributor-facing changes

  • Type errors no longer block git commit — they block git push and CI.
  • Everything removed locally remains covered by CI (lint / format / tsc / registry-drift jobs).

🤖 Generated with Claude Code

https://claude.ai/code/session_01QEkEs1cWYWSvshxhxJZ6od

Add a build job to code-check.yml so PRs that break the Next.js
production build fail CI. The job needs no secrets (all env reads are
defensive), caches apps/www/.next/cache, and uses setup-node@v4 with
node-version-file so the Node version follows .nvmrc. A workflow-level
concurrency group cancels superseded runs on rapid PR pushes.

Rework lefthook.yml around fast, staged-only pre-commit:
- lint/format run directly on staged files instead of the whole project
- registry build uses the www-scoped script (the root script also ran a
  full-project lint:fix + format:fix) and stages generated artifacts by
  explicit path instead of `git add --all`
- full typecheck moves from pre-commit to pre-push; CI remains the
  backstop for everything removed locally

Ignore generated registry JSON in prettier so the format hook can never
reformat build:registry output away from its JSON.stringify form, which
would trip CI's registry-drift check.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QEkEs1cWYWSvshxhxJZ6od
@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

@Yeom-JinHo is attempting to deploy a commit to the product-studio Team on Vercel.

A member of the Team first needs to authorize it.

@Yeom-JinHo
Yeom-JinHo merged commit 76d280a into magicuidesign:main Jul 19, 2026
6 of 7 checks passed
@Yeom-JinHo
Yeom-JinHo deleted the ci/build-check-and-lighter-hooks branch July 19, 2026 11:51
Yeom-JinHo added a commit that referenced this pull request Jul 31, 2026
* ci: make PR check failures self-explanatory and document CI gates

- Align the registry-drift job with the lefthook pre-commit hook:
  simplify the root build:registry to the www-scoped regeneration-only
  command, so unrelated lint errors can no longer fail artifact
  generation or mask the drift result (follow-up to #988; generated
  artifacts are byte-identical, verified with a clean git status after
  regeneration)
- Print the fix command when the lint, format, registry-deps, and
  registry-drift gates fail, surfaced as ::error:: annotations
- Expose registry-deps:fix from the root package.json and point out
  that it edits registry-examples.ts, which requires re-running
  build:registry
- Document the CI gates in CONTRIBUTING (pnpm check, production build,
  committing generated registry artifacts, Conventional Commits) plus
  Node/pnpm prerequisites
- Add a pre-flight checklist to the PR template

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011wJuxcamc1gSFVu9AcKkGp

* ci: tighten review-noted wording in failure messages and docs

- registry-deps failure guidance now names registry-examples.ts, which
  registry-deps:fix edits as a source file, not a generated artifact
- Soften "the four fastest CI gates" to "four of the six CI gates"
  (job timings overlap between runs)
- Scope the git-hooks NOTE: artifact regeneration only triggers for
  staged files under registry/, so a config/site.ts-only change needs a
  manual pnpm build:registry
- PR checklist: add a production-build item and make the
  build:registry item conditional
- Unify the drift/registry-deps annotation wording

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011wJuxcamc1gSFVu9AcKkGp

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant