Skip to content

refactor: Move checkStudioDependencyVersions into cli-build#1080

Open
snocorp wants to merge 2 commits into
mainfrom
cli-build-checkStudioDependencyVersions
Open

refactor: Move checkStudioDependencyVersions into cli-build#1080
snocorp wants to merge 2 commits into
mainfrom
cli-build-checkStudioDependencyVersions

Conversation

@snocorp
Copy link
Copy Markdown
Contributor

@snocorp snocorp commented May 14, 2026

Description

This PR moves checkStudioDependencyVersions into the cli-build package. This logic is used in both the build logic as well as the dev server logic and so it makes sense to move it and export it to be used by both. Eventually it will only need to be exported for the dev server part once the build logic is also moved.

Testing

Moved one unit test into the new package and fixed a mock in the main cli package. Unit tests pass and this is a relatively simple refactor.


Note

Medium Risk
Moderate risk because it changes cross-package wiring for a preflight check used by both build and dev, so a bad export path or dependency mismatch could fail CLI startup in those flows.

Overview
checkStudioDependencyVersions is relocated into @sanity/cli-build and exposed via @sanity/cli-build/_internal, with buildStudio and startStudioDevServer updated to import it from there.

@sanity/cli-build now depends on @sanity/cli-core plus semver (and types), updates TS path mapping accordingly, and the CLI build test suite adjusts mocks to target the new internal export.

Reviewed by Cursor Bugbot for commit aa97bfc. Bugbot is set up for automated code reviews on this repo. Configure here.

@snocorp snocorp self-assigned this May 14, 2026
@snocorp snocorp requested a review from a team as a code owner May 14, 2026 14:28
@claude
Copy link
Copy Markdown

claude Bot commented May 14, 2026

Claude finished @snocorp's task in 2m 4s —— View job


Review

  • Read PR context
  • Review changed files
  • Check changeset
  • Post review

No blocking issues. The refactor is clean: the function moves with its tests, the mock in buildStudio.appIdWarning.test.ts is correctly redirected to @sanity/cli-build/_internal, and no circular dependency is introduced (cli-core doesn't depend on cli-build).

Notes

Changeset — not needed. This is a pure internal refactor: checkStudioDependencyVersions is only consumed inside this monorepo, and @sanity/cli-build only ships an _internal subpath export. End-user behavior of sanity build / sanity dev is unchanged.

Minor observations (non-blocking):

  • packages/@sanity/cli-build/package.json:57,69semver: ^7.7.4 and @types/semver: ^7.7.1 are pinned directly rather than via the workspace catalog. This matches the existing pattern in packages/@sanity/cli/package.json:129,161, so it's consistent, but consider adding semver to the catalog in pnpm-workspace.yaml in a follow-up so the two packages can't drift apart.
  • packages/@sanity/cli-build/src/_exports/_internal.ts — switching from export * to explicit named exports is a nice readability improvement. Worth confirming the previously-implicit getDefaultFaviconsPath export (used by getViteConfig.ts:3) is still listed — it is. ✓
  • The two commits split the dependency add (semver) from the dev-types add (@types/semver); the first commit alone would have failed typecheck. Consider squash-on-merge, or fold them locally before merge.
    Branch

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

📦 Bundle Stats — @sanity/cli

Compared against main (f0906a04)

@sanity/cli

Metric Value vs main (f0906a0)
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 837ms -23ms, -2.7%

bin:sanity

Metric Value vs main (f0906a0)
Internal (raw) 975 B -
Internal (gzip) 460 B -
Bundled (raw) 9.84 MB -
Bundled (gzip) 1.77 MB -
Import time 1.97s -73ms, -3.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 — @sanity/cli-core

Compared against main (f0906a04)

Metric Value vs main (f0906a0)
Internal (raw) 95.5 KB -721 B, -0.7%
Internal (gzip) 22.5 KB -40 B, -0.2%
Bundled (raw) 21.60 MB -721 B, -0.0%
Bundled (gzip) 3.42 MB -93 B, -0.0%
Import time 787ms -26ms, -3.1%

🗺️ 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 (f0906a04)

Metric Value vs main (f0906a0)
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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

Coverage Delta

File Statements
packages/@sanity/cli-build/src/actions/build/checkStudioDependencyVersions.ts 100.0% (new)
packages/@sanity/cli/src/actions/build/buildStudio.ts 96.7% (±0%)
packages/@sanity/cli/src/actions/dev/startStudioDevServer.ts 95.0% (±0%)

Comparing 3 changed files against main @ f0906a0412d9393185bff3be1ec2c2dd9c59ec9d

Overall Coverage

Metric Coverage
Statements 84.3% (±0%)
Branches 74.2% (±0%)
Functions 84.1% (±0%)
Lines 84.7% (±0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants