refactor: move compareDependencyVersions into cli-build#1466
Conversation
📦 Bundle Stats —
|
| Metric | Value | vs main (2287ca1) |
|---|---|---|
| Internal (raw) | 2.2 KB | - |
| Internal (gzip) | 838 B | - |
| Bundled (raw) | 11.16 MB | - |
| Bundled (gzip) | 2.10 MB | - |
| Import time | 674ms | +2ms, +0.3% |
bin:sanity
| Metric | Value | vs main (2287ca1) |
|---|---|---|
| Internal (raw) | 782 B | - |
| Internal (gzip) | 423 B | - |
| Bundled (raw) | 9.87 MB | - |
| Bundled (gzip) | 1.78 MB | - |
| Import time | 1.74s | -9ms, -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 main (2287ca1d)
| Metric | Value | vs main (2287ca1) |
|---|---|---|
| Internal (raw) | 108.1 KB | - |
| Internal (gzip) | 27.0 KB | - |
| Bundled (raw) | 21.72 MB | - |
| Bundled (gzip) | 3.46 MB | - |
| Import time | 602ms | -1ms, -0.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 (2287ca1d)
| Metric | Value | vs main (2287ca1) |
|---|---|---|
| Internal (raw) | 908 B | - |
| Internal (gzip) | 483 B | - |
| Bundled (raw) | 931 B | - |
| Bundled (gzip) | 491 B | - |
| 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 4 changed files against main @ Overall Coverage
|
filmaj
left a comment
There was a problem hiding this comment.
Integration tests are failing - I am happy to pair with you on that, review them, and I hope some of them can be dropped. I have a good sense of unit test coverage on these functions. Also I think a couple of cli-core mocks in this PR are unnecessary.
|
|
||
| vi.mock('@sanity/cli-core', async (importOriginal) => { | ||
| const actual = await importOriginal<typeof import('@sanity/cli-core')>() | ||
| vi.mock(import('@sanity/cli-core'), async (importOriginal) => { |
There was a problem hiding this comment.
This cli-core mock and the next one can be dropped - we don't import these in the cli buildApp anymore (since those imports moved to cli-build)
|
|
||
| vi.mock('@sanity/cli-core', async (importOriginal) => { | ||
| const actual = await importOriginal<typeof import('@sanity/cli-core')>() | ||
| vi.mock(import('@sanity/cli-core'), async (importOriginal) => { |
There was a problem hiding this comment.
Same here, these cli-core mocks are no longer needed
Description
During the integration of cli-build into the runtime cli, I realized that while it's nice to be able to inject this logic, we can't avoid running it when doing a blueprints deployment. This means we need to be able to access it from the cli-build project. The change is fairly small in impact and will allow me to continue integration.
Testing
Updated mocks as needed.
Note
Medium Risk
Major cli-build export changes (removed getModuleUrl, new compareDependencyVersions export) could break internal consumers; runtime behavior of version comparison should be unchanged but package boundaries shifted.
Overview
compareDependencyVersions(and its types) now live in@sanity/cli-buildand are re-exported from@sanity/cli-build/_internal/build, so blueprints/deploy paths inside cli-build can run the same auto-update version checks without duplicating logic in@sanity/cli.@sanity/clibuild/dev actions import that helper from cli-build instead ofsrc/util/compareDependencyVersions. The implementation stops importinggetModuleUrlthrough the internal build barrel (local import fromgetAutoUpdatesImportMapinstead), andgetModuleUrlis dropped from the_internal/buildpublic surface. The separatecompareDependencyVersions.d.tsshim is removed in favor of in-module types.Tests and integration coverage are retargeted to mock/import from
@sanity/cli-build/_internal/build, with some Vitestimport()-style mocks and shared@sanity/cli-testUX mocks. Changeset:@sanity/cli-buildmajor,@sanity/clipatch.Reviewed by Cursor Bugbot for commit ac9954d. Bugbot is set up for automated code reviews on this repo. Configure here.