root: patch changesets to handle workspace ranges differently

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-05-03 14:09:58 +02:00
parent f55cff1140
commit 598e8e51dd
3 changed files with 48 additions and 1 deletions
@@ -0,0 +1,32 @@
diff --git a/dist/changesets-assemble-release-plan.cjs.js b/dist/changesets-assemble-release-plan.cjs.js
index ee5c0f67fabadeb112e9f238d8b144a4d125830f..9b0e1a156dd88cee35f82faf718d82a8a8f80325 100644
--- a/dist/changesets-assemble-release-plan.cjs.js
+++ b/dist/changesets-assemble-release-plan.cjs.js
@@ -179,12 +179,23 @@ function getDependencyVersionRanges(dependentPkgJSON, dependencyRelease) {
if (!versionRange) continue;
if (versionRange.startsWith("workspace:")) {
+ // intentionally keep other workspace ranges untouched
+ // this has to be fixed but this should only be done when adding appropriate tests
+ let workspaceRange = versionRange.replace(/^workspace:/, "");
+ switch (workspaceRange) {
+ case "*":
+ // workspace:* actually means the current exact version, and not a wildcard similar to a reguler * range
+ workspaceRange = dependencyRelease.oldVersion;
+ break;
+ case "~":
+ case "^":
+ // Use ^oldVersion for workspace:^ or ~oldVersion for workspace:~.
+ // The version range might have changed in dependent package, but that should have its own changeset bumping that package.
+ workspaceRange += dependencyRelease.oldVersion;
+ }
dependencyVersionRanges.push({
depType: type,
- versionRange: // intentionally keep other workspace ranges untouched
- // this has to be fixed but this should only be done when adding appropriate tests
- versionRange === "workspace:*" ? // workspace:* actually means the current exact version, and not a wildcard similar to a reguler * range
- dependencyRelease.oldVersion : versionRange.replace(/^workspace:/, "")
+ versionRange: workspaceRange,
});
} else {
dependencyVersionRanges.push({
+1
View File
@@ -84,6 +84,7 @@
},
"prettier": "@spotify/prettier-config",
"resolutions": {
"@changesets/assemble-release-plan@^6.0.0": "patch:@changesets/assemble-release-plan@npm%3A6.0.0#./.yarn/patches/@changesets-assemble-release-plan-npm-6.0.0-f7b3005037.patch",
"@material-ui/pickers@^3.2.10": "patch:@material-ui/pickers@npm%3A3.3.11#./.yarn/patches/@material-ui-pickers-npm-3.3.11-1c8f68ea20.patch",
"@material-ui/pickers@^3.3.10": "patch:@material-ui/pickers@npm%3A3.3.11#./.yarn/patches/@material-ui-pickers-npm-3.3.11-1c8f68ea20.patch",
"@types/react": "^18",
+15 -1
View File
@@ -7817,7 +7817,7 @@ __metadata:
languageName: node
linkType: hard
"@changesets/assemble-release-plan@npm:^6.0.0":
"@changesets/assemble-release-plan@npm:6.0.0":
version: 6.0.0
resolution: "@changesets/assemble-release-plan@npm:6.0.0"
dependencies:
@@ -7831,6 +7831,20 @@ __metadata:
languageName: node
linkType: hard
"@changesets/assemble-release-plan@patch:@changesets/assemble-release-plan@npm%3A6.0.0#./.yarn/patches/@changesets-assemble-release-plan-npm-6.0.0-f7b3005037.patch::locator=root%40workspace%3A.":
version: 6.0.0
resolution: "@changesets/assemble-release-plan@patch:@changesets/assemble-release-plan@npm%3A6.0.0#./.yarn/patches/@changesets-assemble-release-plan-npm-6.0.0-f7b3005037.patch::version=6.0.0&hash=43c5e4&locator=root%40workspace%3A."
dependencies:
"@babel/runtime": ^7.20.1
"@changesets/errors": ^0.2.0
"@changesets/get-dependents-graph": ^2.0.0
"@changesets/types": ^6.0.0
"@manypkg/get-packages": ^1.1.3
semver: ^7.5.3
checksum: b7a68e28d03379bdc2a1d7171963990e1b88d0e5efca5f5ed490c0f583d66d0ccbd4c04ebf4e5cd1c38e1346ff0e5c4c16e1b4973cdd97fabdbad0c6996fe016
languageName: node
linkType: hard
"@changesets/changelog-git@npm:^0.2.0":
version: 0.2.0
resolution: "@changesets/changelog-git@npm:0.2.0"