Only bump peer dependents when leaving range using an experimental flag#383
Only bump peer dependents when leaving range using an experimental flag#383emmatown merged 15 commits intochangesets:masterfrom
Conversation
🦋 Changeset is good to goLatest commit: 2778497 We got this. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
.changeset/new-pianos-act.md
Outdated
| @@ -0,0 +1,7 @@ | |||
| --- | |||
| "@changesets/assemble-release-plan": patch | |||
There was a problem hiding this comment.
This is a major to assemble-release-plan, apply-release-plan and any other package that exposes a function that accepts a Config object
There was a problem hiding this comment.
Marked the following packages major - assemble-release-plan, apply-release-plan and @changesets/get-release-plan.
Out of curiosity, only @changesets/assemble-release-plan consumes the experimental flag for now, why do we want to bump major for apply-release-plan and get-release-plan?
Second question - Why do we want to use major for them at all? It seems to me a minor version bump suffices because it's not a breaking change. You kinda touched on it in #185 (comment), but I don't think I understand
We'll likely do lots of majors to internal packages(as in the packages that aren't the cli package) when changing these options because otherwise we would have to use exact ranges everywhere
Can you please elaborate?
There was a problem hiding this comment.
Hm, I'm also not sure about this - future changes should be majors (if we are worried about breaking those unsafe flags - which we don't for the top-level packages, we don't want to major bump cli, so Im also unsure why we should care about breaking them for internal ones, the only thing that comes to my mind are fresh reinstalls), but adding the first "unsafe" flag shouldn't require major bump based on my understanding.
There was a problem hiding this comment.
If we did not do a major for assemble-release-plan, people would get broken installs for anything below the latest version of @changesets/cli because they could have the new version of @changesets/assemble-release-plan where we depend on config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange existing and an old version of @changesets/config.
The reason that it's also important to bump other packages which accept a Config object is that we've added a new required property to the Config object so therefore they should have major bumps. This will manifest concretely in the form of type errors(for consumers of the internal packages) but it's also a conceptual thing that would still exist if we did not have types, types are just making it visible.
This is similar to something often seen in the React community where React adds a new feature like forwardRef or hooks, adding that feature isn't a major for React but it if a consumer starts using that new feature, that consumer has to do a major bump.
|
Could you add a test to https://github.com/atlassian/changesets/blob/master/packages/cli/src/commands/version/version.test.ts for something like this: A project that looks like this:
Then you add the following changeset:
The project should look like this:
|
Done. I actually didn't handle this case before, so it required some code changes as well. Would you mind explain the rationale behind keeping |
Yep, that. |
| return getBumpLevel(release.type) >= minLevel; | ||
| } | ||
|
|
||
| export function shouldUpdatePeerDependency( |
There was a problem hiding this comment.
Could you merge this function with shouldUpdateInternalDependency? I find it understand to understand what's going on here with the way the logic is working in versionPackage and this particular part of Changesets is something that's very important that we get right and it's hard to check if it's hard to understand
There was a problem hiding this comment.
Done. Also moved the test from cli package to apply-release-plan because that's where we test updateInternalDependencies.
|
@mitchellhamilton Do you think we are ready to merge it? I'd like to create a PR (code is ready) for #381 (comment) which depends on this one. |
|
Thank you for your submission! Like many open source projects, we ask that you sign our CLA (Contributor License Agreement) before we can accept your contribution. Already signed the CLA? To re-check, try refreshing the page. |
## Summary <!-- Succinctly describe your change, providing context, what you've changed, and why. --> We use non-local peer dependencies due to a restriction with the build process of `inngest`. This contributes to changesets bumping peer dependencies for packages that want to reference `inngest` from their wide constraint (e.g. `^3.0.0`) to a narrower one (e.g. `^3.7.1`). I believe we can avoid this using an experimental flag added in changesets/changesets#383. ## Checklist <!-- Tick these items off as you progress. --> <!-- If an item isn't applicable, ideally please strikeout the item by wrapping it in "~~"" and suffix it with "N/A My reason for skipping this." --> <!-- e.g. "- [ ] ~~Added tests~~ N/A Only touches docs" --> - [ ] ~~Added a [docs PR](https://github.com/inngest/website) that references this PR~~ N/A - [ ] ~~Added unit/integration tests~~ N/A - [x] Added changesets if applicable ## Related - changesets/changesets#383 - changesets/changesets#524
Replaces #185
Introduces an experimental flag
onlyUpdatePeerDependentsWhenOutOfRange. When set totrue, peer dependents are bumped only if the peerDep version is leaving range.