Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 6b940a9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2092 +/- ##
==========================================
+ Coverage 84.12% 84.53% +0.41%
==========================================
Files 80 80
Lines 3162 3163 +1
Branches 892 889 -3
==========================================
+ Hits 2660 2674 +14
+ Misses 445 432 -13
Partials 57 57 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cschanhniem
left a comment
There was a problem hiding this comment.
Good fix. The pre-exit bump logic for ignored independent packages is a subtle edge case — I can see how it slipped through. The key insight is that ignored packages are intentionally excluded from preInfo.preVersions, which makes preVersions.get(name) return undefined, and undefined !== 0 is true, bypassing the guard.
The hoisted shouldSkipPackage check is the right fix — it covers both branches (new release and upgrade-from-none) without changing behavior for non-ignored packages.
One small suggestion on the test: the new test asserts that the ignored package is NOT bumped, which is the right assertion. It might also be worth adding a companion test that verifies an ignored package that IS a dependent of something being released still gets the correct treatment (i.e., it should be skipped via the existing else if branch, not via the new guard). That ensures the hoisted check doesn't inadvertently change the dependent-ignored behavior.
The changeset entry (spicy-zebras-camp.md) makes sense — this is a patch-level fix for assemble-release-plan.
✅ Deploy Preview for changesets ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| // we want to give it a patch release. | ||
| // Detailed explanation at https://github.com/changesets/changesets/pull/382#discussion_r434434182 | ||
| if (preInfo.preVersions.get(pkg.packageJson.name) !== 0) { | ||
| if (preVersion != null && preVersion !== 0) { |
There was a problem hiding this comment.
Changed to a check like this as preInfo.preVersions already does not included ignored packages and we can rely on that check
| expect(releases[1].newVersion).toEqual("1.0.1-next.0"); | ||
| }); | ||
|
|
||
| it("should not bump ignored independent packages that had a prerelease when exiting pre-release mode", () => { |
There was a problem hiding this comment.
Does this reported situation relate to a temporarily or permanently ignored package? If the first one, how do you expect to handle the ignored package's transition to the unignored state?
Problem
When exiting pre mode,
assembleReleasePlangives apatchbump to any package whose recorded pre-version isn't0(i.e. it had a prerelease during the pre phase), so that packages that were prereleased but didn't otherwise get a bump still get released. The intent is documented here.However, this block does not consistently respect the
ignoreconfig (andprivatePackages.version):nonerelease in the plan (e.g. an ignored dev dependent), theelse ifbranch correctly checksshouldSkipPackageand skips it.if (!existingRelease)branch creates apatchrelease without checkingshouldSkipPackage.As a result, an ignored, standalone package that happened to have a prerelease version gets bumped on
pre exiteven though the user explicitly ignored it (and passed e.g.--ignore <pkg>). This matches the report in #1543, where a package that other packages do not depend on is incorrectly version-bumped on pre exit.Note that ignored packages are intentionally excluded from
preInfo.preVersions(ingetPreInfo), sopreVersions.get(name)returnsundefinedfor them, andundefined !== 0istrue— which is exactly what slips them past the guard.Fix
Hoist the
shouldSkipPackagecheck to the top of the condition so it guards both the "create new patch release" and the "upgrade existing none → patch" branches, and drop the now-redundant check from theelse if. Behavior for non-ignored packages is unchanged.Tests
Added a test asserting that an ignored, independent package that had a prerelease is not bumped when exiting pre mode (it fails without the fix). The existing "should not bump ignored dev dependents when exiting pre-release mode" test continues to pass, and the full test suite is green.
Closes #1543