Skip to content

Dev-stamp the standalone CLI version in nightly builds#3928

Merged
bcotrim merged 4 commits into
trunkfrom
stu-1772-stamp-cli-dev-version
Jun 23, 2026
Merged

Dev-stamp the standalone CLI version in nightly builds#3928
bcotrim merged 4 commits into
trunkfrom
stu-1772-stamp-cli-dev-version

Conversation

@bcotrim

@bcotrim bcotrim commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Related issues

  • Related to STU-1772 — the standalone CLI update workflow depends on this.

How AI was used in this PR

Caught during real-world testing: installing a published nightly CLI showed studio --version1.11.0, even though the Apps CDN publishes that same nightly as 1.12.0-dev103. Traced it to prepare-dev-build-version.mjs dev-stamping only apps/studio/package.json. I reviewed the change myself.

Proposed Changes

prepare-dev-build-version.mjs rewrites the version to the X.(Y+1).0-devN dev form for nightly/dev builds — but only for the desktop app (apps/studio/package.json). The standalone CLI (apps/cli/package.json) was left at the static base version, so its baked __STUDIO_CLI_VERSION__ (what studio --version reports) didn't match the version the bundle is actually published under on the CDN.

This stamps apps/cli/package.json with the same dev version. After it:

  • studio --version on a nightly reports its real version (e.g. 1.12.0-dev103) instead of a static, meaningless 1.11.0.
  • It unblocks the standalone CLI update notifier (STU-1772): the CLI derives its update channel from its own version (-devN → nightly), so it needs the real dev version baked in to check the right channel. Without this, a nightly install looks like "production" to the update endpoint and never sees nightly updates.

Testing Instructions

GITHUB_SHA=$(git rev-parse HEAD) node ./scripts/prepare-dev-build-version.mjs
grep '"version"' apps/studio/package.json apps/cli/package.json
# → both show the same X.(Y+1).0-devN (e.g. 1.12.0-dev103), matching the CDN-published nightly
git checkout -- apps/studio/package.json apps/cli/package.json   # revert the local mutation

The CLI build (cli:bundle) runs after this script in the build pipelines, so the bundle bakes the stamped version.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors? — build script only; ran it and verified both files stamp to the same dev version.

Comment thread scripts/prepare-dev-build-version.mjs Outdated
// endpoint, and never sees nightly updates.
const cliPackageJsonPath = path.resolve( 'apps', 'cli', 'package.json' );
const cliPackageJson = JSON.parse( await fs.readFile( cliPackageJsonPath, 'utf8' ) );
cliPackageJson.version = devVersion;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no guarantee that the apps/cli version is the same as the apps/studio version.

Let's read the current version from apps/cli/package.json and add to it the same way we do with the version from apps/studio/package.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize that this may not have been that big a concern given our versioning strategy (CLI-only releases are allowed to bump the patch version, and app releases always bump the minor version). Still, it makes sense for the code to be resilient

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@wpmobilebot

wpmobilebot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing f87571e vs trunk

app-size

Metric trunk f87571e Diff Change
App Size (Mac) 2344.38 MB 2344.38 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk f87571e Diff Change
load 1079 ms 1082 ms +3 ms ⚪ 0.0%

site-startup

Metric trunk f87571e Diff Change
siteCreation 6503 ms 6531 ms +28 ms ⚪ 0.0%
siteStartup 6977 ms 6986 ms +9 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@bcotrim bcotrim merged commit 26f7e54 into trunk Jun 23, 2026
11 checks passed
@bcotrim bcotrim deleted the stu-1772-stamp-cli-dev-version branch June 23, 2026 15:47
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.

3 participants