Skip to content

feat(cli): localize a whole template, and stop format:check failing on a local file - #511

Merged
Ducksss merged 1 commit into
devfrom
claude/localize-template-flag
Aug 29, 2026
Merged

Ducksss merged 1 commit into
devfrom
claude/localize-template-flag

Conversation

@Ducksss

@Ducksss Ducksss commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Two small follow-ups to payload-components localize (#499). Independent of each other; split by commit message paragraph if you'd rather take one.

1. add-template <slug> --localized

add has had --localized since #499, but add-template did not — so installing a template landed fifteen-plus blocks unlocalized and needed a separate localize pass straight afterwards. Now:

npx payload-components add-template saas-launch --localized

The wrinkle worth reviewing. add --localized prints a notice when the Payload config declares no locales, because localized: true is inert without them. add-template loops addCommand once per block, so threading the flag naively would have printed that same warning once per block — seventeen times for portfolio-solo. addCommand therefore takes an internal deferLocaleNotice, and add-template emits the notice once for the run.

The plan gained a matching line, from a real --dry-run against a fixture project:

Localization:
  every block's text fields marked localized: true (17 configs)

warnWhenNoLocalesDeclared is now exported from add.ts so add-template can call it once. The add-template spec mocks the whole ./add module, so the mock carries both exports.

2. .prettierignore covers .claude/settings.local.json

Claude Code writes that file per machine. It is git-ignored — usually through a global gitignore, which is why git status stays silent about it — but prettier --check . still walks the working tree and found it, so pnpm format:check failed locally on a file no commit can contain.

CI never saw it, since the file does not exist on a fresh clone. Every local gate run did. format:check now exits 0.

Tests

Three new int cases: the flag reaching every block, the notice deferring per block and firing exactly once for the run, and the unflagged default staying unlocalized. One pre-existing CLI case also needed updating — it pinned addTemplateCommand's exact call shape, which now carries localized.

Verification

Rebased onto current dev (45600eea, which brought Next 16.3.3 and an analytics/SEO spec change) and re-run there, not just on the original base:

Step Result
install --frozen-lockfile (no churn) · source:build · lint · tsc --noEmit · test:registry pass
format:check pass — 0 for the first time
test:int 612 passed, 1 skipped
build:e2e · test:e2e (PLAYWRIGHT_SERVER_MODE=production) 593 passed

The e2e run was on the pre-rebase base; the four commits dev gained touch analytics-contract.int.spec.ts and fumadocs-site.int.spec.ts, neither of which this branch modifies, and the int suite passes on the rebased tree. CI covers the combination.

Note for the eventual promote

No closing keyword here — per AGENTS.md those belong in the dev → main promote body.

🤖 Generated with Claude Code

…n a local file

Two small follow-ups to the localize command (#499).

`add-template <slug> --localized` installs every block a template composes with
its text fields marked localized, so a fifteen-block site does not need a second
pass. `add --localized` prints a notice when the Payload config declares no
locales; looping that per block would repeat it once per block — seventeen times
for portfolio-solo — so `addCommand` takes an internal `deferLocaleNotice` and
`add-template` emits it once for the run, alongside a Localization line in the
plan.

`.prettierignore` now lists `.claude/settings.local.json`. It is git-ignored,
usually through a global gitignore, so `git status` stays quiet about it while
`prettier --check .` still walks it — which failed `pnpm format:check` locally on
a file no commit can contain. CI never saw it; every local gate run did.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 29, 2026 10:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vercel

vercel Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
payload-components Ready Ready Preview Aug 29, 2026 10:31am
payload-components-97bf Ready Ready Preview Aug 29, 2026 10:31am

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 44 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8154847a-bd66-4998-958d-d3e28dfad626

📥 Commits

Reviewing files that changed from the base of the PR and between 45600ee and 11a2a37.

📒 Files selected for processing (10)
  • .prettierignore
  • AGENTS.md
  • README.md
  • content/docs/cli.mdx
  • content/docs/localization.mdx
  • tests/int/payload-components-add-template.int.spec.ts
  • tests/int/payload-components-cli.int.spec.ts
  • tools/payload-components/cli.ts
  • tools/payload-components/commands/add-template.ts
  • tools/payload-components/commands/add.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Ducksss
Ducksss enabled auto-merge (squash) August 29, 2026 14:44
@Ducksss
Ducksss merged commit 068231e into dev Aug 29, 2026
12 checks passed
@Ducksss
Ducksss deleted the claude/localize-template-flag branch August 29, 2026 16:31

This branch was successfully deployed

2 active deployments
Preview – payload-components-97bf — 11a2a37b Deployed Aug 29, 2026 by vercel[bot]
Preview – payload-components — 11a2a37b Deployed Aug 29, 2026 by vercel[bot]
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.

2 participants