feat: add app resources to sanity.cli.ts#878
Conversation
|
Claude finished @cngonzalez's task in 2m 1s —— View job Review
Changeset description is too vague
Schema allows empty strings for required resource fields
Fix: add z.object({
dataset: z.string().min(1),
projectId: z.string().min(1),
})Schema test name is misleading
|
📦 Bundle Stats —
|
| Metric | Value | vs main (2fd358f) |
|---|---|---|
| Internal (raw) | 2.1 KB | - |
| Internal (gzip) | 799 B | - |
| Bundled (raw) | 10.95 MB | +5.9 KB, +0.1% |
| Bundled (gzip) | 2.05 MB | +1014 B, +0.0% |
| Import time | 822ms | +3ms, +0.4% |
bin:sanity
| Metric | Value | vs main (2fd358f) |
|---|---|---|
| Internal (raw) | 975 B | - |
| Internal (gzip) | 460 B | - |
| Bundled (raw) | 9.84 MB | - |
| Bundled (gzip) | 1.77 MB | - |
| Import time | 1.93s | -0ms, -0.0% |
🗺️ 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 (2fd358fc)
| Metric | Value | vs main (2fd358f) |
|---|---|---|
| Internal (raw) | 93.2 KB | -562 B, -0.6% |
| Internal (gzip) | 21.9 KB | -7 B, -0.0% |
| Bundled (raw) | 21.62 MB | -568 B, -0.0% |
| Bundled (gzip) | 3.42 MB | -61 B, -0.0% |
| Import time | 782ms | +4ms, +0.5% |
🗺️ 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 (2fd358fc)
| Metric | Value | vs main (2fd358f) |
|---|---|---|
| Internal (raw) | 976 B | - |
| Internal (gzip) | 507 B | - |
| Bundled (raw) | 50.7 KB | - |
| Bundled (gzip) | 12.6 KB | - |
| 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
|
cngonzalez
left a comment
There was a problem hiding this comment.
functionally looks good -- most of my comments are just pedantic. Let me know what you think!
|
@cngonzalez great suggestions, ready for review again |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
7a6ae95 to
21fbd90
Compare
1293c23 to
0669398
Compare
…validation - Introduced two app templates: one with resources and one without - Updated the createAppCliConfig function to select the appropriate template. - removing support for media library and canvas resources.
0669398 to
5c73dc9
Compare

Description
This PR adds CLI config support for named app resources and updates app scaffolding to generate those resources by default.
It introduces
app.resourcesto the CLI config types and schema, exports the related resource types from@sanity/cli-core, and updatescreateAppCliConfig()/bootstrapLocalTemplate()so newly scaffolded apps emit aresources.defaultentry with the selectedprojectIdanddataset. This creates a shared config foundation for the later SDK v3 runtime work.What to review
app.resourcestype surface in@sanity/cli-coresanity.cli.tsfiles now include:app.resources.default.projectIdapp.resources.default.dataset@sanity/cli-coreare the right public API for follow-up workTesting
app.resourcesvariantsprojectId/datasetvalues to flow through the template processorpnpm test packages/@sanity/cli-core/src/config/cli/__tests__/schemas.test.ts packages/@sanity/cli/src/actions/init/__tests__/createAppCliConfig.test.tsNote
Medium Risk
Introduces a new public config surface (
app.resources) and changes app project scaffolding output, which could affect downstream consumers and generated config expectations. Scope is limited to config typing/validation and init template generation.Overview
Adds named app resources support via
app.resourcesinsanity.cli.*, including a newAppResourcetype and Zod schema validation for{projectId, dataset}resource entries.Updates app initialization scaffolding so
createAppCliConfig()emits aresources.defaultblock only when bothprojectIdanddatasetare available, and wires those variables throughbootstrapLocalTemplate(). Adds targeted tests for schema acceptance/rejection and for template selection behavior.Reviewed by Cursor Bugbot for commit 5c73dc9. Bugbot is set up for automated code reviews on this repo. Configure here.