Skip to content

refactor: Move logic for getting env vars into cli-build package#1373

Draft
snocorp wants to merge 3 commits into
mainfrom
cli-build-get-environment-variables
Draft

refactor: Move logic for getting env vars into cli-build package#1373
snocorp wants to merge 3 commits into
mainfrom
cli-build-get-environment-variables

Conversation

@snocorp

@snocorp snocorp commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Description

This PR moves the logic for getting environment variables for apps and studios into the build package where it will mainly be used. One small change in this refactor is that we now directly reference vite in the module rather than referencing through a sepatate loadEnv module file.

Testing

Moved related test file.

@snocorp snocorp self-assigned this Jun 24, 2026
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Stats — @sanity/cli

Compared against main (de9e3326)

@sanity/cli

Metric Value vs main (de9e332)
Internal (raw) 2.7 KB -
Internal (gzip) 1.0 KB -
Bundled (raw) 11.16 MB -
Bundled (gzip) 2.10 MB -
Import time 680ms +13ms, +2.0%

bin:sanity

Metric Value vs main (de9e332)
Internal (raw) 782 B -
Internal (gzip) 423 B -
Bundled (raw) 9.87 MB -
Bundled (gzip) 1.78 MB -
Import time 1.53s +10ms, +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 — @sanity/cli-core

Compared against main (de9e3326)

Metric Value vs main (de9e332)
Internal (raw) 106.7 KB -
Internal (gzip) 26.7 KB -
Bundled (raw) 21.72 MB -
Bundled (gzip) 3.46 MB -
Import time 618ms +25ms, +4.2%

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

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

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Coverage Delta

File Statements
packages/@sanity/cli-build/src/actions/build/getEnvironmentVariables.ts 100.0% (new)
packages/@sanity/cli/src/actions/build/buildApp.ts 94.3% (±0%)
packages/@sanity/cli/src/actions/build/buildStaticFiles.ts 32.5% (±0%)
packages/@sanity/cli/src/actions/build/buildStudio.ts 94.5% (±0%)
packages/@sanity/cli/src/server/devServer.ts 5.5% (±0%)

Comparing 5 changed files against main @ de9e33266b8ece80753729cc49ca923b68741631

Overall Coverage

Metric Coverage
Statements 74.2% (±0%)
Branches 64.2% (±0%)
Functions 69.1% (±0%)
Lines 74.8% (±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.

1 participant