refactor: rename manifest types and share cache dir#1008
Conversation
|
Claude finished @gu-stav's task in 2m 29s —— View job Review
1. Changeset should be removed
2.
|
📦 Bundle Stats —
|
| Metric | Value | vs main (37f9577) |
|---|---|---|
| Internal (raw) | 2.1 KB | - |
| Internal (gzip) | 799 B | - |
| Bundled (raw) | 10.94 MB | - |
| Bundled (gzip) | 2.05 MB | - |
| Import time | 750ms | +4ms, +0.5% |
bin:sanity
| Metric | Value | vs main (37f9577) |
|---|---|---|
| Internal (raw) | 975 B | - |
| Internal (gzip) | 460 B | - |
| Bundled (raw) | 9.84 MB | - |
| Bundled (gzip) | 1.77 MB | - |
| Import time | 1.80s | +7ms, +0.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 — @sanity/cli-core
Compared against main (37f95779)
| Metric | Value | vs main (37f9577) |
|---|---|---|
| Internal (raw) | 93.1 KB | - |
| Internal (gzip) | 21.9 KB | - |
| Bundled (raw) | 21.60 MB | - |
| Bundled (gzip) | 3.42 MB | - |
| Import time | 712ms | +4ms, +0.6% |
🗺️ 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 (37f95779)
| Metric | Value | vs main (37f9577) |
|---|---|---|
| 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.
| export const coreAppManifestSchema = z.object({ | ||
| icon: z.optional(z.string()), | ||
| title: z.optional(z.string()), | ||
| version: z.string(), |
There was a problem hiding this comment.
Version field type widened from literal to string
Low Severity
The old AppManifest interface constrained version to the string literal '1', but the new coreAppManifestSchema uses z.string(), widening it to any string. This loses compile-time enforcement that version is exactly '1'. A z.literal('1') would preserve the original type safety while still using zod.
Reviewed by Cursor Bugbot for commit ad3ca35. Configure here.
joshuaellis
left a comment
There was a problem hiding this comment.
I think it makes sense. Lets se what the rest of the team thinks.
Coverage Delta
Comparing 7 changed files against main @ Overall Coverage
|
| '@sanity/cli': patch | ||
| --- | ||
|
|
||
| Extract `SANITY_CACHE_DIR` constant for the shared Vite cache path and rename the internal `AppManifest` type to `CoreAppManifest` (with a zod schema) for consistency with the workbench payload. |
There was a problem hiding this comment.
Is the changeset necessary?
There was a problem hiding this comment.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d1ea114. Configure here.
| sourcemap: true, | ||
| }, | ||
| cacheDir: 'node_modules/.sanity/vite', | ||
| cacheDir: `${SANITY_CACHE_DIR}/vite`, |
There was a problem hiding this comment.
Test uses same constant as production code
Low Severity
The test assertion for cacheDir was changed from the hardcoded string 'node_modules/.sanity/vite' to use the same SANITY_CACHE_DIR constant that production code uses. This makes the assertion tautological for the constant's value — if SANITY_CACHE_DIR were accidentally set to an incorrect path, both the production code and the test would use the wrong value, and the test would still pass. The previous hardcoded string provided an independent verification of the expected path.
Reviewed by Cursor Bugbot for commit d1ea114. Configure here.
d1ea114 to
d885116
Compare


Description
Pure refactoring:
cacheDirusing a newSANITY_CACHE_DIRconstant, because we will need it in a 3rd place to avoid driftAppManifesttoCoreAppManifestto be more in-line with Brett, where SDK apps havetype: coreAppThis will reduce the overall changes, introduced in #997, between
feat/workbenchandmainNote
Low Risk
Low risk refactor that centralizes Vite cache directory configuration and renames/validates the core app manifest type; main risk is unintended type/schema mismatch affecting app deploy manifest payloads.
Overview
Refactors cache directory configuration by introducing
SANITY_CACHE_DIRand updating VitecacheDirusage (including vendor builds and tests) to derive from this shared path.Renames and tightens manifest typing by replacing
AppManifestwithCoreAppManifest, adding a zod-backedcoreAppManifestSchema, and updating deploy/manifest extraction and deployment API typing to use the new validated manifest payload.Reviewed by Cursor Bugbot for commit db62592. Bugbot is set up for automated code reviews on this repo. Configure here.