Skip to content

fix(cli): make the starter base actually compile, and prove it with a bare-app smoke - #458

Merged
Ducksss merged 1 commit into
devfrom
feat/bare-app-smoke
Aug 9, 2026
Merged

Ducksss merged 1 commit into
devfrom
feat/bare-app-smoke

Conversation

@Ducksss

@Ducksss Ducksss commented Aug 9, 2026

Copy link
Copy Markdown
Owner

#448 shipped the starter base bundle with a stated gap: it is target code this repository cannot typecheck — payload-components/source is excluded from tsc and there is no payload dependency here. The tests proved the bundle made an undetectable project detectable, was idempotent, and never clobbered. They did not prove the copied code compiles.

This adds the scenario that proves it. It found three real bugs on its first run. Two shipped in v1.3.0.

What it caught

1. The base renderer corrupted itself on install — shipped in v1.3.0

RenderBlocks.tsx declared const blockComponents = {} with both braces on one line. The fragment patcher inserts a block's entry on the line above the closing brace — which here is the same line as the opening one, so the entry landed above the declaration:

import { HeroBasicBlock } from '@/blocks/HeroBasic/Component'
  heroBasic: HeroBasicBlock,
const blockComponents = {}

Two installs produced a file that does not parse. Fixed by shipping the multi-line shape the patcher assumes.

2. The patcher could do that to any consumer — pre-existing

const blockComponents = {} satisfies the detection anchor, so a real project written that way passed detection and got a corrupted file. The patcher now breaks a same-line object open rather than inserting above it, with a regression test.

3. The base renderer did not typecheck once populated — shipped in v1.3.0

Indexing the object literal types as never while the map is empty — the only state this repository could ever observe — and stops compiling the moment a block is installed into it. The lookup now widens to unknown and narrows back through a real runtime check.

4. init --scaffold reported success on a half-initialized project

shadcn init can exit 0 without writing components.json (a declined prompt, or a non-interactive shell that cannot answer one). The command scaffolded on top of that and printed next steps for a project that still could not install anything. It now stops and says what to do — and skips shadcn init entirely when components.json already exists, which makes it idempotent.

Documented prerequisite

Every installed block is Tailwind-classed, and shadcn init refuses without a Tailwind config — which the blank create-payload-app template does not ship. That was always true of the registry; the website starter simply hid it. It is now stated where a bare-app user reads.

The scenario

pnpm test:fresh -- --scenario bare

Scaffold a blank project → assert it really is bare → install the packed CLI → set up Tailwind and shadcn → init --scaffold → install two blocks chosen to exercise all four consumer primitives (hero-basic covers cn + CMSLink + linkGroup, content-image-lead adds Media) → stop at tsc --noEmit.

It skips seed, build, boot, and Playwright — roughly a third of the website scenario's runtime for the one thing that could not be checked anywhere else. --scenario website keeps the old behaviour; all runs both and is the default, so CI gains the coverage without changing how it is invoked.

A spec asserts the chosen blocks really do import all four primitives, so the scenario cannot quietly stop exercising one.

Verification

lint · format:check · tsc · test:registry all 0 · 509 int (+4) · 397 e2e across all five batches · pnpm test:fresh -- --scenario bare green end to end.

Follow-up

Bugs 1 and 3 are live in [email protected]: init --scaffold followed by any add produces a RenderBlocks.tsx that does not compile. This warrants a 1.3.1 patch once merged.

🤖 Generated with Claude Code

… bare-app smoke

#448 shipped the starter base bundle with a stated gap: it is target code this
repository cannot typecheck, because payload-components/source is excluded from
tsc and there is no `payload` dependency here. Coverage proved the bundle made an
undetectable project detectable, was idempotent, and never clobbered — it did not
prove the copied code compiles.

This adds the scenario that proves it, and it found three real bugs on its first
run. Two of them shipped in v1.3.0.

**The base renderer corrupted itself on install.** `RenderBlocks.tsx` declared
`const blockComponents = {}` with both braces on one line, so the fragment
patcher — which inserts a block's entry on the line above the closing brace —
wrote the entry *above the declaration*. Two installs produced a file that does
not parse. Fixed by shipping the multi-line shape the patcher assumes.

**The patcher could do that to any consumer.** `const blockComponents = {}`
satisfies the detection anchor, so a real project written that way passed
detection and got a corrupted file. The patcher now breaks a same-line object
open instead of inserting above it, with a regression test.

**The base renderer did not typecheck once populated.** Indexing the object
literal types as `never` while the map is empty, which is the only state this
repository could ever see, and stops compiling the moment a block is installed.
The lookup now widens to `unknown` and narrows back through a real runtime check.

**`init --scaffold` reported success on a half-initialized project.** `shadcn
init` can exit 0 without writing components.json — a declined prompt, or a
non-interactive shell that cannot answer one. The command scaffolded on top of
that and printed next steps for a project that still could not install anything.
It now stops and says what to do. It also skips shadcn init entirely when
components.json already exists, which makes the command idempotent.

**Documented prerequisite.** Every installed block is Tailwind-classed and
`shadcn init` refuses without a Tailwind config, which the blank
create-payload-app template does not ship. That was always true of the registry;
the website starter simply hid it. It is now stated where a bare-app user reads.

The scenario runs as `pnpm test:fresh -- --scenario bare`: scaffold a blank
project, assert it really is bare, install the packed CLI, set up Tailwind and
shadcn, run `init --scaffold`, install two blocks chosen to exercise all four
consumer primitives, and stop at `tsc --noEmit`. It skips seed, build, boot, and
Playwright — roughly a third of the website scenario's runtime for the one thing
that could not be checked anywhere else. `--scenario website` keeps the old
behaviour and `all` runs both, which is the default.

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

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 9, 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 9, 2026 3:00pm
payload-components-97bf Ready Ready Preview Aug 9, 2026 3:00pm

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Ducksss, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e49de366-3be1-44b8-8431-fcbf94c5535a

📥 Commits

Reviewing files that changed from the base of the PR and between 77f28ea and c7e2e42.

📒 Files selected for processing (8)
  • AGENTS.md
  • content/docs/cli.mdx
  • payload-components/source/base/blocks/RenderBlocks.tsx
  • tests/int/fresh-payload-smoke.int.spec.ts
  • tests/int/payload-components-fragment.int.spec.ts
  • tools/payload-components/commands/init.ts
  • tools/payload-components/project.ts
  • tools/payload-components/smoke/fresh-payload-repo.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.

This branch was successfully deployed

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