cli(feat): add opt-in demo seed + leak-proof admin field hints#147
Open
Ducksss wants to merge 1 commit into
Open
cli(feat): add opt-in demo seed + leak-proof admin field hints#147Ducksss wants to merge 1 commit into
Ducksss wants to merge 1 commit into
Conversation
Help users reach good block content after install, two ways, without baking sample copy into saved documents: - `payload-components seed <name>` and `add <name> --demo` write a runnable seed script (payload-components/seed-<name>.ts) that creates one labeled, deletable example Page (slug payload-components-demo-<name>) pre-filled from manifest.sampleContent. The CLI never opens the database — the user runs the script via `payload run` in their own toolchain, so the published bundle keeps its ajv+semver-only runtime-dependency contract. Seed-script generation is extracted into a Playwright-free shared module (tools/payload-components/seed/seed-script.ts) reused by the smoke harness. - admin.placeholder / admin.description hints on the shared field modules and the HeroBasic/EmbedBasic configs. They render in the admin but are never written to the document, so guidance can't leak to production. Deliberately NOT defaultValue. Tests: new add --demo orchestration cases; smoke-seed unit test repointed to the shared module. Verified locally: tsc, lint, registry:check, test:int (68 passed), test:pack (dep contract holds). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
|
Retargeted to |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
payload-components seed <name>andpayload-components add <name> --demowrite a runnable seed script (payload-components/seed-<name>.ts) that creates one labeled, deletable example Page (/payload-components-demo-<name>) pre-filled frommanifest.sampleContent.payload run, so the published bundle keeps itsajv+semver-only runtime-dependency contract. Seed-script generation is extracted into a Playwright-free shared module (tools/payload-components/seed/seed-script.ts) reused verbatim by the fresh-project smoke harness.admin.placeholder/admin.descriptionacross the 7 shared field modules + theHeroBasic/EmbedBasicconfigs. These render in the admin but are never written to the document — deliberately notdefaultValue, which would persist and could ship to production.Why: installed blocks arrive with empty fields and no signal of intended content, which doesn't match the filled-in catalog preview. This gives developers a one-time, catalog-matching example page (opt-in, deletable) and gives editors persistent in-field guidance — without any path for sample copy to reach production.
Verification
pnpm test:releaseRan locally and green:
pnpm lint,pnpm source:build,tsc --noEmit,pnpm test:registry,pnpm test:int(68 passed, 1 skipped — incl. new--demoorchestration cases and the repointed smoke-seed unit test),pnpm test:pack(dependency contract holds — 0 Playwright refs indist/cli.js). Not yet run:pnpm test:e2e, the finalpnpm build, and the heavypnpm test:fresh(fullcreate-payload-appE2E) — left for CI.Registry Checklist
public/routput out of git. (public/r is gitignored; rebuilt locally to confirm the field hints embed correctly, not committed.)seed/--democommands are not added yet — see Notes.)overrideAccess+context.disableRevalidate, idempotent delete-then-create of a single labeled slug.)Notes
seed/--demowrite the script; the user then runs it (pnpm exec payload run payload-components/seed-<name>.ts) to create the page. The CLI cannot open the DB without breaking itsajv+semverdependency contract. An auto-run mode (spawn the project's ownpayload runas a subprocess, like the smoke harness) is a straightforward follow-up if a one-command flow is preferred.manifest.sampleContentwith the site'ssrc/lib/demo-content.ts(they currently drift), and docs for the new commands.🤖 Generated with Claude Code