Recreate yarn.lock when preparing new release - #16375
Open
Vladimir Morozov (vmoroz) wants to merge 1 commit into
Open
Recreate yarn.lock when preparing new release#16375Vladimir Morozov (vmoroz) wants to merge 1 commit into
Vladimir Morozov (vmoroz) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates release automation so generated version-bump commits include a synchronized Yarn lockfile.
Changes:
- Adds a helper to refresh
yarn.lockwithout modifying installed dependencies. - Runs the refresh after Beachball bumps versions on the PR-creation path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
prepareRelease.ts |
Invokes lockfile regeneration before staging the release commit. |
beachballBump.ts |
Adds the Yarn lockfile-update helper with immutable installs disabled. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Andrew Coates (acoates-ms)
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Type of Change
Why
The
prepare-releaseautomation (the bot that opens the "RELEASE: Releasing Npackage(s)" / Version Packages PRs) bumps package versions with beachball but
never regenerated
yarn.lock. beachball only rewritespackage.jsonandchangelog files, so the committed lockfile drifted out of sync with the bumped
versions.
Since the move to Yarn 4, CI installs with
yarn install --immutable, whichtreats any lockfile drift as a fatal error (
YN0028: The lockfile would have been modified by this install, which is explicitly forbidden). As a result everyrelease PR failed all of its validation jobs at the
yarn install (immutable)step. Only the Setup job passed, because it skips the immutable install on
release builds — which is why the failure looked like "everything except setup is
red."
What
updateLockfile()helper to theprepare-releasetool that runsyarn install --mode=update-lockfile. It refreshesyarn.lockto match thefreshly bumped
package.jsonfiles without touchingnode_modules. Immutableinstalls are enabled by default under CI, so the helper disables them for that
single call (
YARN_ENABLE_IMMUTABLE_INSTALLS=false).so the generated release commit carries a
yarn.lockconsistent with theversion bump.
--bump-onlypath used by developerCI builds is left untouched, because those builds never commit the lockfile.
Screenshots
N/A.
Testing
npx lage build --scope @rnw-scripts/prepare-releasesucceeds.
yarn install --mode=update-lockfilewith immutable installs disabled): exits 0, does not raise
YN0028, and Yarnreports the link step skipped due to
mode=update-lockfile— confirming it onlyrewrites the lockfile. On an already-consistent tree it is a no-op.
next time the bot runs against a branch that has pending change files.
Changelog
Should this change be included in the release notes: no
This is release/build tooling, not a user-facing runtime change.
(
@rnw-scripts/prepare-releaseis a private package, so no change file isrequired.)
Microsoft Reviewers: Open in CodeFlow