feat(templates): add page-builder template using @sanity/presets#1084
feat(templates): add page-builder template using @sanity/presets#1084jordanl17 wants to merge 3 commits into
Conversation
|
Claude finished @jordanl17's task in 4m 25s —— View job ReviewScope is well-contained. Comments below are graded by impact. Minor
Nits
Changeset
|
📦 Bundle Stats —
|
| Metric | Value | vs main (94b25c3) |
|---|---|---|
| Internal (raw) | 2.1 KB | - |
| Internal (gzip) | 799 B | - |
| Bundled (raw) | 10.97 MB | +98 B, +0.0% |
| Bundled (gzip) | 2.06 MB | +24 B, +0.0% |
| Import time | 820ms | -5ms, -0.6% |
bin:sanity
| Metric | Value | vs main (94b25c3) |
|---|---|---|
| Internal (raw) | 1023 B | - |
| Internal (gzip) | 486 B | - |
| Bundled (raw) | 9.84 MB | - |
| Bundled (gzip) | 1.77 MB | - |
| Import time | 1.96s | +1.05s, +114.8% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @sanity/cli-core
Compared against main (94b25c36)
| Metric | Value | vs main (94b25c3) |
|---|---|---|
| Internal (raw) | 97.0 KB | +1.5 KB, +1.6% |
| Internal (gzip) | 22.7 KB | +248 B, +1.1% |
| Bundled (raw) | 21.61 MB | +1.5 KB, +0.0% |
| Bundled (gzip) | 3.42 MB | +263 B, +0.0% |
| Import time | 780ms | -11ms, -1.4% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — create-sanity
Compared against main (94b25c36)
| Metric | Value | vs main (94b25c3) |
|---|---|---|
| Internal (raw) | 908 B | -68 B, -7.0% |
| Internal (gzip) | 483 B | -24 B, -4.7% |
| Bundled (raw) | 931 B | -70 B, -7.0% |
| Bundled (gzip) | 491 B | -23 B, -4.5% |
| Import time | ❌ ChildProcess denied: node | - |
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
Coverage Delta
Comparing 3 changed files against main @ Overall Coverage
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1bbd83b. Configure here.
| types: schemaTypes, | ||
| }, | ||
| }) | ||
| ` |
There was a problem hiding this comment.
Redundant configTemplate duplicates the existing default template
Low Severity
The configTemplate string in pageBuilder.ts is functionally identical to the defaultTemplate already defined in createStudioConfig.ts (differing only in plugins array formatting). When a template omits configTemplate, createStudioConfig automatically falls back to defaultTemplate — as blog.ts, clean.ts, and quickstart.ts already do. This duplication adds maintenance burden with no functional benefit; the entire configTemplate constant and its assignment in pageBuilderTemplate can be removed.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 1bbd83b. Configure here.
jwoods02
left a comment
There was a problem hiding this comment.
Hey @jordanl17 looking great from AI Growth perspective, I'll let @juice49 approve the specifics of the template code.
Just a quick note that we plan to run a onboarding experiment in the next week or two so please give us a heads up in rd-ai-growth before putting this on in prod in case we're worried it could mess with our xp stats, but should be all good


Description
SAPP-3677 tracks adding a starter Studio template that demonstrates
@sanity/presets, a recently released package providing ready-made schema factories (definePage,defineImage,defineCta,defineRichText) for page-builder patterns. The CLI's init flow had no template that exercised the package.This PR adds a
page-buildertemplate usingdefinePagewith hero/image/CTA/rich-text blocks, a shared presets registry configured so internal links target Page documents, and a custom hero block composingdefineImageanddefineCtainline. The picker entry is gated to non-production environments viaSANITY_INTERNAL_ENV !== 'production'so the template can be tested in staging before broader release.What to review
scaffoldTemplate.ts- extractedgetTemplateChoices(env)as a pure helper so the gating is unit-testable; the--templateflag path intentionally bypasses the env checktemplates/pageBuilder.ts- shape mirrorsmoviedb.ts(configTemplate + dependencies)schemaTypes/hero.js- referencesimageBlockrather thanimagebecause Sanity reservesimageas a primitive type nameschemaTypes/index.js- shared presets registry;link.internalTypes: ['page']cascades to CTAs and rich-text annotationsTesting
Unit tests cover the env-gating in both directions and assert the
@sanity/presetsdependency is declared. Smoke tested end-to-end by building the CLI, scaffolding a studio withSANITY_INTERNAL_ENV=staging sanity init, and verifying the Page document renders all four block types plus SEO.Note
Low Risk
Low risk: changes are additive and the new template option is gated to non-production environments, leaving production init behavior unchanged aside from a small refactor of the template choice list.
Overview
Adds a new
page-buildertemplate tosanity initthat scaffolds a simple page-builder schema using@sanity/presets(page, hero, image, CTA, rich-text) and includes a new template README.Refactors template selection to use a new
getTemplateChoices(getSanityEnv())helper and gates thepage-builderchoice to non-productionSANITY_INTERNAL_ENVvalues, with unit tests covering both the env gating and the template’s declared@sanity/presetsdependency.Reviewed by Cursor Bugbot for commit 1bbd83b. Bugbot is set up for automated code reviews on this repo. Configure here.