From 682793dfa4400ace5a87b49df4b6ecc73a653c7b Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 23 Aug 2023 16:40:17 -0700 Subject: [PATCH] chore: patch @lerna/conventional-commits to avoid version bump for prereleases 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. closes #8242 --- .../@lerna+conventional-commits+5.6.2.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/@lerna+conventional-commits+5.6.2.patch diff --git a/patches/@lerna+conventional-commits+5.6.2.patch b/patches/@lerna+conventional-commits+5.6.2.patch new file mode 100644 index 00000000000..d92bec4e6bf --- /dev/null +++ b/patches/@lerna+conventional-commits+5.6.2.patch @@ -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 a982adf..453ef14 100644 +--- a/node_modules/@lerna/conventional-commits/lib/recommend-version.js ++++ b/node_modules/@lerna/conventional-commits/lib/recommend-version.js +@@ -58,6 +58,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";