Skip to content

Commit 8afef6a

Browse files
committed
fix changeset release to avoid bump package to 1.x when peer dependency is still on 0.x release
There are many issues on changeset repository: - changesets/changesets#1011 - changesets/changesets#1228 - changesets/changesets#1126
1 parent 80806c2 commit 8afef6a

3 files changed

Lines changed: 36 additions & 4 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
"vitest": "^2.1.9"
8383
},
8484
"patchedDependencies": {
85-
"babel-plugin-annotate-pure-calls@0.4.0": "patches/babel-plugin-annotate-pure-calls@0.4.0.patch"
85+
"babel-plugin-annotate-pure-calls@0.4.0": "patches/babel-plugin-annotate-pure-calls@0.4.0.patch",
86+
"@changesets/assemble-release-plan@6.0.9": "patches/@changesets__assemble-release-plan@6.0.9.patch"
8687
}
8788
}
8889
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/dist/changesets-assemble-release-plan.cjs.js b/dist/changesets-assemble-release-plan.cjs.js
2+
index e07ba6e793021b6cfdec898afca517e293386ddb..7c4e5c70318b7748e29a9e8310dfeac970b65225 100644
3+
--- a/dist/changesets-assemble-release-plan.cjs.js
4+
+++ b/dist/changesets-assemble-release-plan.cjs.js
5+
@@ -317,6 +317,9 @@ function shouldBumpMajor({
6+
preInfo,
7+
onlyUpdatePeerDependentsWhenOutOfRange
8+
}) {
9+
+ if (depType === "peerDependencies" && nextRelease.oldVersion && nextRelease.oldVersion.startsWith("0.")) {
10+
+ return false;
11+
+ }
12+
// we check if it is a peerDependency because if it is, our dependent bump type might need to be major.
13+
return depType === "peerDependencies" && nextRelease.type !== "none" && nextRelease.type !== "patch" && (
14+
// 1. If onlyUpdatePeerDependentsWhenOutOfRange set to true, bump major if the version is leaving the range.
15+
diff --git a/dist/changesets-assemble-release-plan.esm.js b/dist/changesets-assemble-release-plan.esm.js
16+
index ea2be567403c4ef94a65f3218ccb683cf5cb4bc1..439f4bb50670e2860e7d506cd62d1993769cee22 100644
17+
--- a/dist/changesets-assemble-release-plan.esm.js
18+
+++ b/dist/changesets-assemble-release-plan.esm.js
19+
@@ -306,6 +306,9 @@ function shouldBumpMajor({
20+
preInfo,
21+
onlyUpdatePeerDependentsWhenOutOfRange
22+
}) {
23+
+ if (depType === "peerDependencies" && nextRelease.oldVersion && nextRelease.oldVersion.startsWith("0.")) {
24+
+ return false;
25+
+ }
26+
// we check if it is a peerDependency because if it is, our dependent bump type might need to be major.
27+
return depType === "peerDependencies" && nextRelease.type !== "none" && nextRelease.type !== "patch" && (
28+
// 1. If onlyUpdatePeerDependentsWhenOutOfRange set to true, bump major if the version is leaving the range.

pnpm-lock.yaml

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)