Commit 9a751fd
authored
feat(version): rewrite consumer pins on major bumps (#85)
When versionPackagesExplicit bumps a workspace package's major,
walk every other workspace package.json and rewrite any
\`dependencies\`/\`devDependencies\`/\`peerDependencies\` ref to the
bumped package whose existing semver range no longer satisfies the
new version. Preserves the existing range prefix (\`^\`, \`~\`, \`>=\`,
…). Minor and patch bumps skip the walk entirely — the existing
caret/tilde range already satisfies the new version, so yarn keeps
resolving the workspace symlink and there's no need to touch any
consumer's package.json.
Why: lerna's \`version\` flow does this automatically. The
explicit-bumps path in #82 lost the behavior, so a 2.x → 3.0.0
release on a workspace package would leave every consumer pinned
to \`^2.0.1\`. yarn falls back to the published 2.x copy on the
registry — still carrying the old pre-migration source — which
broke optimistic-balances' build in exodus-hydra#16530.
Skips refs that aren't semver ranges:
- \`workspace:*\` / \`workspace:^\`
- \`npm:@scope/alias@…\`
- \`file:\` / \`link:\` / \`portal:\`
- URLs (anything with \`://\`)
- dist-tags (\`*\`, \`latest\`, \`next\`)
Adds 13 new tests covering: basic rewrite, range-prefix preservation
(^/~), staging into the release commit, the 8 skip protocols (each as
its own .each row), cross-section rewrite (deps/devDeps/peerDeps),
and the 5 non-major bump levels (minor/patch/preminor/prepatch/
prerelease) as a single .each — confirming non-major bumps leave
consumers untouched.
181/181 tests passing (was 165, +16).1 parent 9b99965 commit 9a751fd
5 files changed
Lines changed: 395 additions & 22 deletions
File tree
- dist/version
- src
- version
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
0 commit comments