Repository navigation
Conversation
🦋 Changeset is good to goLatest commit: 5da8125 We got this. 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 |
| expect(releases[0].newVersion).toEqual("1.0.1"); | ||
| }); | ||
| it("should major bump dependent when bumping caret peerDep by minor", () => { | ||
| setup.updatePeerDep("pkg-b", "pkg-a", "^1.0.0"); |
There was a problem hiding this comment.
We should add a second test here which is still checking on caret, where a caret peerDep is major bumped.
There was a problem hiding this comment.
There's a test for that below this test(it was already there)
Agree. Would love @lukebatchelor 's opinion before we merge this change as it impacts atlaskit stuff. |
|
Also, other problem - when a package has a peer dependency with an exact version and the peer dep is patch bumped, should the peer dependent be patch or major bumped? |
|
Doesn't this PR lead to the issue where your peerDependency introduces some new functionality (minor change), it is still in range so you don't bump, then down the track you start consuming that functionality. At this point, your package.json is actually wrong right? Because you haven't bumped the minimum required version that would expose that feature to you, so its possible that a consumer has an older (but still satisfying) peerDep which breaks (I'll refer to this as the Or am I misunderstanding the change? This does bring up a conversation that has been on our backlog for ages though, that I'll likely create a full issue for us to discuss Soon™. The current bumping behaviour of automatically bumping the minimum versions of packages when they are released at the same time was added to prevent the That is: it increases the total number of combinations of our packages that are not compatible with eachother, leading to package duplication on the consumer (yarn's upgrade behaviour is very no bueno here). An example would be:
At that scale, its .seriously no big problem, everything working as expected. This falls down when you have hundreds of packages depending on eachother and you need to do a sweeping change on all of them at once. Not only would we not have hit the Theres a bit more nuance to this problem that we need to talk about but thought I'd mention it briefly (really Luke? Briefly?) to get you across it. |
|
You're understanding this change correctly. The
I feel like the trade off of "if you want Changesets to bump peer dependents on minors, use a tilde" is good because it allows both options, yes of course it increases the version fragmentation problem but idk, I feel like it's okay. ¯\_(ツ)_/¯ |
IMHO, in that case, it would be OK to just patch that peer dependent - given "pragmatically correct semver" policy 😉
Not sure if I understand this. When [email protected] could get installed without dragging with itself also [email protected]? A general note - aren't peer deps somewhat a special case in general? From things I use on a daily basis (or have used) the ones that were peers: React, Babel, TypeScript, Emotion, XState. Not really that many - usually we just deal with regular dependencies. So when one develops a monorepo with a thing used as peer dependency (such as Emotion) they should be aware of the extra risk when it comes to version management around this. Of course, this is a manual~ thing (mental overhead) and thus error-prone but I haven't yet seen many times people failing at this. However - with automated releasing, one's instinct around that might fail more often than when managing things manually. Going back to how it works now - I don't even think this is an ultimate solution, it just maybe minimizes the risk a little bit, right? The only thing that it actually changes is that one might spot unmet peer dep warning after bumping peer-dependent package - but it's not in any way a solution that really makes things seamless (again - due to nature of peer deps). Most times in the wild when peer dep range changes it's actually a major bump for the peer-dependent package - but there is no way for changesets to automate this reliably. So maybe if it cannot be automated it just shouldn't affect (within minor ranger) other packages at all? |
|
Is there any plan to release this change? It is a blocker for us to adopt Currently I realized the current behavior could be desirable for some people, so perhaps we can add an option that allows peerDependencies to remain unchanged if it is in range. Something like |
|
I would be much in favor of releasing this behavior under a flag - so people can actually use and test it, even if it comes as |
|
Yeah, 💯, this should exist as an unsafe option. The way I think this should work is that there should be a Some thoughts on this: When we add an option to this, it's us saying "There's probably a problem in here that needs to be solved but it hasn't been totally figured out yet, here's a solution to it that might be right but also might be wrong, we're not sure yet.". This addresses the immediate problems that people have by letting people experiment with potential solutions but it also solves a much larger problem. It doesn't restrict us in changing the implementation of Changesets but kind of more importantly, it doesn't restrict the mental model of what Changesets can do and become in the future because it doesn't force us to release solutions that are incomplete or not totally well thought out which means that instead of having to choose between two bad options in the future(1. Remove a feature which people thought was well-supported and therefore annoy a lot of people. 2. Keep a feature and annoy a lot of people/leave them with bad solutions). It's very important to note here that this does not mean we're saying "we don't care about this problem" instead it means, "we likely care about this problem but we won't restrict ourselves to this particular solution." A practical thing: 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 but we won't do majors to the cli package when changing these options because that would create a lot of churn for consumers. Users of the experimental options should pin an exact version of |
|
Thanks for the insight! That sounds reasonable to me. Do you have a sense of when you will be able to get to it ( |
|
Probably not very soon. We'd be happy to accept a PR for it though. (assuming @Noviny has no objections to this which I doubt they will) |
|
#383 @mitchellhamilton Can you please take a look? |
|
Closing this PR because having this behavior by default won't come from this PR |
Part of the motivation behind this is I want to be able to minor version Emotion. I think doing this is a good thing because people can get back nearly the exact same behavior by changing from a caret to a tilde but people also have more control over when peer dependents are bumped.
This probably isn't something we should do soon since we should probably batch other breaking changes.