Skip to content

Commit

Permalink
chore: patch @lerna/conventional-commits to avoid version bump for pr…
Browse files Browse the repository at this point in the history
…ereleases

(cherry-picked from commit b1917d6
from trunk, contained in PR #8243)

We used to patch this library to reduce the `releaseType` level for
our packages that had not yet reached 1.0 . We then switched to an
upstream version which performed this reduction itself, except not
when doing a "prerelease". Now that we need to do a prerelease, we'd
like this reduction behavior in both arms of the conditional, so this
commit re-introduces our original patch.

refs #8242
  • Loading branch information
warner committed Aug 23, 2023
1 parent d2975a7 commit e886a60
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions patches/@lerna+conventional-commits+3.22.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/node_modules/@lerna/conventional-commits/lib/recommend-version.js b/node_modules/@lerna/conventional-commits/lib/recommend-version.js
index f524f9d..a9b5427 100644
--- a/node_modules/@lerna/conventional-commits/lib/recommend-version.js
+++ b/node_modules/@lerna/conventional-commits/lib/recommend-version.js
@@ -53,6 +53,15 @@ function recommendVersion(pkg, type, { changelogPreset, rootPath, tagPrefix, pre
// we still need to bump _something_ because lerna saw a change here
let releaseType = data.releaseType || "patch";

+ // Don't gratuitously break compatibility with clients using `^0.x.y`.
+ if (semver.major(pkg.version) === 0) {
+ if (releaseType === "major") {
+ releaseType = "minor";
+ } else if (releaseType === "minor") {
+ releaseType = "patch";
+ }
+ }
+
if (prereleaseId) {
const shouldBump = shouldBumpPrerelease(releaseType, pkg.version);
const prereleaseType = shouldBump ? `pre${releaseType}` : "prerelease";

0 comments on commit e886a60

Please sign in to comment.