refactor: split out build logic into a new package#1062
Conversation
|
Claude finished @snocorp's task in 5m 6s —— View job ReviewMost prior bugbot comments have been resolved in later commits (static folder is now back in the cli-build files array, typescript devDep added, vitest oclif config cleaned up, e2e tsconfig now correctly maps Remaining issues worth fixing: 1. The new package has no JSX/React but - "transform": {
- "react": {
- "runtime": "automatic"
- }
- },
"target": "es2023"2. Only 3.
await fs.writeFile(path.join(destDir, 'manifest.webmanifest'), content, 'utf8')Notes (non-blocking)
|
|
❌ Bundle Stats — An error occurred while calculating bundle sizes. Error details |
Coverage Delta
Comparing 7 changed files against main @ Overall Coverage
|
📦 Bundle Stats —
|
| Metric | Value | vs main (cc636d1) |
|---|---|---|
| Internal (raw) | 2.1 KB | - |
| Internal (gzip) | 799 B | - |
| Bundled (raw) | 10.97 MB | - |
| Bundled (gzip) | 2.06 MB | - |
| Import time | 863ms | +4ms, +0.4% |
bin:sanity
| Metric | Value | vs main (cc636d1) |
|---|---|---|
| Internal (raw) | 975 B | - |
| Internal (gzip) | 460 B | - |
| Bundled (raw) | 9.84 MB | - |
| Bundled (gzip) | 1.77 MB | - |
| Import time | 2.05s | +290ms, +16.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 (cc636d1f)
| Metric | Value | vs main (cc636d1) |
|---|---|---|
| Internal (raw) | 95.5 KB | - |
| Internal (gzip) | 22.5 KB | - |
| Bundled (raw) | 21.60 MB | - |
| Bundled (gzip) | 3.42 MB | - |
| Import time | 821ms | +6ms, +0.7% |
🗺️ 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 (cc636d1f)
| Metric | Value | vs main (cc636d1) |
|---|---|---|
| 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.
Preview this PR with pkg.pr.newRun the Sanity CLInpx https://pkg.pr.new/sanity-io/cli/@sanity/cli@d18dcb5 <command>...Or upgrade project dependencies📦
|
rexxars
left a comment
There was a problem hiding this comment.
Nothing blocking but:
- The
actionsnomenclature is more of a CLI thing (separating the actual "actions" from the "command", the former being more of the "api" and the latter being what gathers input and controls the flow of the CLI command), so for a build package that is more of an API, these can probably just live at the root ofsrc - The public API surface is a little weird right now, but I understand the intention is to move to higher level APIs and expose those
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 125f435. Configure here.

Description
The goal of this PR is to move some logic from the main cli package into a new cli-build package. This will eventually allow the runtime-cli package to use the build logic to prepare blueprints assets to be deployed by a blueprints resource provider. I stopped here to help make these changes easier to digest. The next PR will likely involve moving a lot of files from cli to cli-build and that's a lot of noise whereas this PR mostly focuses on the new project setup.
What to review
Ensure package setup is done correctly and follows standards and conventions for this repo.
Testing
Testing will be done by using
pkg-prto create a build from this PRNote
Medium Risk
Moderate risk because it introduces a new workspace package and rewires CLI build-time imports/packaging (favicons/static asset generation) plus CI/E2E publishing flows, which could impact build output or release packaging if misconfigured.
Overview
Introduces a new workspace package,
@sanity/cli-build, to host shared build utilities (initiallycopyDir, favicon + web manifest helpers) with its own build/test/lint configs and_internalexport surface.Refactors
@sanity/clibuild pipeline to consume these utilities via@sanity/cli-build/_internal(including replacingread-package-uproot resolution withgetDefaultFaviconsPath) and updates related unit tests accordingly.Updates repo tooling/CI to recognize and ship the new package: workspace + lockfile,
check:types/Turbo deps, Knip and Vitest projects/coverage, E2E tarball packing/install, and preview package publishing/docs; also removes@sanity/cli’s bundledstaticdirectory and notes bundle-stats TODO for the new package.Reviewed by Cursor Bugbot for commit 314e9f6. Bugbot is set up for automated code reviews on this repo. Configure here.