-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from DataDog/hardy.jones/uiapps-104/link-ui-ex…
…tensions-packages UIAPPS-104 Link UI Extensions packages
- Loading branch information
Showing
10 changed files
with
236 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js b/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js | ||
index 20a16c8..cf83233 100644 | ||
--- a/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js | ||
+++ b/node_modules/@changesets/assemble-release-plan/dist/assemble-release-plan.cjs.dev.js | ||
@@ -243,6 +243,11 @@ function shouldBumpMajor({ | ||
preInfo, | ||
onlyUpdatePeerDependentsWhenOutOfRange | ||
}) { | ||
+ // Don't force a major bump if the dependent is a peer deependency and it's an exact version. | ||
+ if (depType === "peerDependencies" && versionRange === nextRelease.oldVersion) { | ||
+ return false; | ||
+ } | ||
+ | ||
// we check if it is a peerDependency because if it is, our dependent bump type might need to be major. | ||
return depType === "peerDependencies" && nextRelease.type !== "none" && nextRelease.type !== "patch" && ( // 1. If onlyUpdatePeerDependentsWhenOutOfRange set to true, bump major if the version is leaving the range. | ||
// 2. If onlyUpdatePeerDependentsWhenOutOfRange set to false, bump major regardless whether or not the version is leaving the range. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# `npm` patches | ||
|
||
This directory holds patches for `npm` dependencies. | ||
|
||
## `@changesets/assemble-release-plan` | ||
|
||
This patch makes it so peer dependencies that are exact don't force a major bump in `changesets`. | ||
We should still be able to make major bumps, | ||
but they shouldn't happen due to exact peer dependencies. | ||
|
||
This only really works for packages that are "linked." | ||
We should probably add a check for that in the same logic, | ||
but we should really raise the issue upstream and see if there's a fix for it. | ||
|
||
It's not clear whether or not this will go away when ["fixed" packages][] are implemented. | ||
|
||
["fixed" packages]: https://github.com/changesets/changesets/pull/690 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env node | ||
const getReleasePlan = require('@changesets/get-release-plan').default; | ||
|
||
const packageInfo = require('./package-info'); | ||
|
||
/** | ||
* Checks that if any `@datadog/ui-extensions-*` package is getting a release, | ||
* all `@datadog/ui-extensions-*` packages are getting a release. | ||
* | ||
* While `changesets` does have support for "linked" packages: | ||
* https://github.com/changesets/changesets/blob/main/docs/linked-packages.md, | ||
* it's not exactly what we want. | ||
* The way "linked" packages work, | ||
* we can still leave out packages that we want to be on the same version. | ||
* | ||
* We do still want "linked" packages in our `.changeset/config.json`, | ||
* since it means we'll always get everything on the same version. | ||
* To that end, | ||
* this check doesn't need to actually look at specific version numbers. | ||
* We just have to catch packages that might be missed. | ||
* | ||
* The behavior we want is actually what's being proposed as "fixed" packages: | ||
* https://github.com/changesets/changesets/pull/690. | ||
* Until that feature is released, | ||
* we have this check to make sure we release packages in lock-step. | ||
*/ | ||
async function main() { | ||
const errors = []; | ||
|
||
const releasePlan = await getReleasePlan('.'); | ||
const releases = releasePlan.changesets.flatMap(changeset => { | ||
return changeset.releases; | ||
}); | ||
const packageNames = releases.map(release => { | ||
return release.name; | ||
}); | ||
const hasUIExtensionsPackages = packageNames.some(packageName => { | ||
return packageName.startsWith('@datadog/ui-extensions-'); | ||
}); | ||
|
||
if (!hasUIExtensionsPackages) { | ||
return; | ||
} | ||
|
||
const uiExtensionsPackages = packageInfo.getUIExtensionsPackages(); | ||
for (const uiExtensionsPackage of uiExtensionsPackages) { | ||
if (packageNames.includes(uiExtensionsPackage.packageJSON.name)) { | ||
continue; | ||
} | ||
|
||
errors.push( | ||
`${uiExtensionsPackage.filename}: please use "yarn changeset add" to add a changeset for "${uiExtensionsPackage.packageJSON.name}".` | ||
); | ||
} | ||
|
||
packageInfo.handleErrors(errors); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.