feat: create runtime resources#961
feat: create runtime resources#961cngonzalez wants to merge 3 commits intostack/sdk-711-app-resources-basefrom
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
📦 Bundle Stats —
|
| Metric | Value | vs stack/sdk-711-app-resources-base (5c73dc9) |
|---|---|---|
| Internal (raw) | 2.1 KB | - |
| Internal (gzip) | 799 B | - |
| Bundled (raw) | 10.95 MB | - |
| Bundled (gzip) | 2.05 MB | - |
| Import time | 836ms | +0ms, +0.0% |
bin:sanity
| Metric | Value | vs stack/sdk-711-app-resources-base (5c73dc9) |
|---|---|---|
| Internal (raw) | 975 B | - |
| Internal (gzip) | 460 B | - |
| Bundled (raw) | 9.84 MB | - |
| Bundled (gzip) | 1.77 MB | - |
| Import time | 944ms | +5ms, +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 — @sanity/cli-core
Compared against stack/sdk-711-app-resources-base (5c73dc97)
| Metric | Value | vs stack/sdk-711-app-resources-base (5c73dc9) |
|---|---|---|
| Internal (raw) | 93.2 KB | - |
| Internal (gzip) | 21.9 KB | - |
| Bundled (raw) | 21.62 MB | - |
| Bundled (gzip) | 3.42 MB | - |
| Import time | 796ms | +6ms, +0.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 — create-sanity
Compared against stack/sdk-711-app-resources-base (5c73dc97)
| Metric | Value | vs stack/sdk-711-app-resources-base (5c73dc9) |
|---|---|---|
| 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.
b827481 to
7e378de
Compare
7a6ae95 to
21fbd90
Compare
|
Claude finished @cngonzalez's task in 2m 31s —— View job Review
1. Changeset summary is too vague
2.
If app templates are TypeScript-only, this is fine — but it's worth an explicit check or comment guarding this assumption. Fix this → 3.
4. Missing init-flow test coverage There's a new integration test for the build and dev commands that verify On the file placement question ( |
d81d395 to
f216058
Compare
f216058 to
44d6e01
Compare
44d6e01 to
7a82fca
Compare
Coverage Delta
Comparing 10 changed files against main @ Overall Coverage
|
|
|
||
| if (isApp) { | ||
| buildDebug('Writing resources.ts') | ||
| await fs.writeFile(path.join(cwd, '.sanity', 'resources.ts'), generateResourcesTs(resources)) |
There was a problem hiding this comment.
Looking for feedback on this as the filepath for this automatically generated file. It can live elsewhere, I wasn't quite sure.
This means that users will see an explicit /.sanity directory in their IDEs etc.
74b974e to
e4ffd48
Compare
7a82fca to
201f40c
Compare
e4ffd48 to
62824bd
Compare
63ee72a to
708b15e
Compare
1293c23 to
0669398
Compare
708b15e to
673930b
Compare
28db82f to
a813d05
Compare
0669398 to
5c73dc9
Compare
|
Closing for now, since we're not going in this direction. |

Description
The initial way of thinking about injecting resources, via a
renderSanityApp, meant that any top-level parameters (like auth options, or any new parameters) would have to be lifted tosanity.cli.tsand coordinated with a CLI release. It also meant that there was a bit of friction between the SDK and CLI versions -- what if someone went to a new CLI but was on SDK v2? Or vice versa?This PR simplifies things by assuming the shape of an SDK App is largely the same. We still get the benefits of having resources in an easily-serializable and readable form in
sanity.cli.ts, but we can now import it from a file we generate and track. It also offers type safety forresourceName.(This PR is an update on ideas brought forward in internal documents about maintaining a Vite plugin -- it was decided to go simpler, with less magic).
This PR purposely does not update the existing app templates to read from this directory yet -- that can come in a separate PR.
What to review
I'm most curious about the resources file -- its placement and name. Does it seem all right? Any issues?
Testing
Some tests were added.
Notes for release
Writes .sanity/resources.ts with type-safe resource declarations during app build and dev server start