fix(workbench): watch for changes of the cli config file#1022
fix(workbench): watch for changes of the cli config file#1022gu-stav merged 2 commits intofeat/workbenchfrom
Conversation
|
Claude finished @gu-stav's task in 2m 51s —— View job Review
Missing changeset No
A Cache eviction relies on jiti's CJS registration key matching
const cjsRequire = createRequire(import.meta.url)
delete cjsRequire.cache[configPath]This is correct for jiti's current CJS transform behaviour, but it's fragile: if jiti ever changes how it registers files (e.g. using a derived key, adding a URL prefix, or switching to ESM-native caching), repeated calls to |
📦 Bundle Stats —
|
| Metric | Value | vs feat/workbench (9f660ec) |
|---|---|---|
| Internal (raw) | 2.1 KB | - |
| Internal (gzip) | 799 B | - |
| Bundled (raw) | 10.94 MB | - |
| Bundled (gzip) | 2.05 MB | - |
| Import time | 876ms | +14ms, +1.7% |
bin:sanity
| Metric | Value | vs feat/workbench (9f660ec) |
|---|---|---|
| Internal (raw) | 975 B | - |
| Internal (gzip) | 460 B | - |
| Bundled (raw) | 9.84 MB | - |
| Bundled (gzip) | 1.77 MB | - |
| Import time | 2.47s | +55ms, +2.3% |
🗺️ 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 feat/workbench (9f660ec0)
| Metric | Value | vs feat/workbench (9f660ec) |
|---|---|---|
| Internal (raw) | 95.5 KB | +1.4 KB, +1.5% |
| Internal (gzip) | 22.5 KB | +422 B, +1.9% |
| Bundled (raw) | 21.62 MB | +1.4 KB, +0.0% |
| Bundled (gzip) | 3.42 MB | +485 B, +0.0% |
| Import time | 845ms | +24ms, +2.9% |
🗺️ 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 feat/workbench (9f660ec0)
| Metric | Value | vs feat/workbench (9f660ec) |
|---|---|---|
| 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 69 changed files against main @ Overall Coverage
|
Description
While recording the demo I noticed changing the title in a CLI config file for an SDK didn't make it through into workbench. This is happening because the CLI config is cached and only read once.
This PR adds a new method to read a fresh config file every time and initializes the same watcher we are using for the studio config file already. Now updating the title in the CLI config is reflected almost immediately in the dock.
Note
Medium Risk
Introduces an uncached
sanity.cli.(ts|js)loader that clears Node’s module cache and wires core-app dev mode into the manifest watcher, which could affect dev-server stability/perf if cache invalidation or watch triggers behave unexpectedly.Overview
Workbench/core-app dev now tracks edits to
sanity.cli.(ts|js)so changes like title/icon propagate without restarting.This adds
getCliConfigUncached()in@sanity/cli-coreto bypass both the in-memory config cache and Node/jitirequire.cache, updates core-app manifest extraction to use it, and switchesdevActionto always runstartDevManifestWatcher(now generic and extractor-injected) for both studios and core apps, with tests updated/expanded to cover the new watch/extract wiring.Reviewed by Cursor Bugbot for commit 1c1d116. Bugbot is set up for automated code reviews on this repo. Configure here.