Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't update when it would break a peer dependency #278

Open
mythmon opened this issue Aug 26, 2016 · 12 comments
Open

Don't update when it would break a peer dependency #278

mythmon opened this issue Aug 26, 2016 · 12 comments

Comments

@mythmon
Copy link

mythmon commented Aug 26, 2016

If I have two packages, A and B, and A has a peerdependency on B@^2.0, Greenkeper should not file a PR to update B to a version outside that range, unless A is being updated too.

This issue caused mozilla/normandy#235 to be created, when it should not have been.

@bjacobel
Copy link

bjacobel commented Oct 11, 2016

Here's an example of a Greenkeeper PR (actually the second Greenkeeper has made for this dependency) that I cannot merge because it would cause an unsatisfied peerDependency. bjacobel/rak#29

Edit: Travis CI actually notes this in the npm install log for that PR, I should probably find a way to make the build fail on unmet peerDependencies. https://travis-ci.org/bjacobel/rak/builds/166727590#L584

@janl
Copy link
Contributor

janl commented Jun 15, 2017

This also applies to ecosystems that don’t use peerDependencies, but the alle-style monorepo like PouchDB

cc @gr2m, who’s been flagging this before.

@janl
Copy link
Contributor

janl commented Jun 15, 2017

More user feedback:

@ljharb
Copy link

ljharb commented Jun 15, 2017

A suggestion: temporarily modify travis.yml with an after_install line that runs npm ls >/dev/null. If it fails, parse the failure output to detect peer dep conflicts. Might work?

@gr2m
Copy link
Contributor

gr2m commented Jun 15, 2017

This also applies to ecosystems that don’t use peerDependencies, but the alle-style monorepo like PouchDB

cc @gr2m, who’s been flagging this before.

For monorepos I suggested to look at the "repo" value in the package.json. If there are multiple packages that point to the same repository I would consider it a monorepo and update dependencies from it all at once.

Did you mean that?

For peerDependencies I would suggest we update the defined range in peerDependencies as we update the same module in devDependencies. With the difference that I would turn peerDependencies into version ranges that can cross breaking version numbers. Say I have eslint-plugin-import as both dev & peer dependency. If it updates from 2.1.3 to 3.0.0 I would update in devDependency to ^3.0.0 and in peer dependency to >=2.1.3 < 4

Would that be helpful? I think that would addrees @mythmon’s problem

If I have two packages, A and B, and A has a peerdependency on B@^2.0, Greenkeper should not file a PR to update B to a version outside that range, unless A is being updated too.

@ljharb
Copy link

ljharb commented Jun 15, 2017

@gr2m just to clarify, peer deps are in the dep itself, not the package-being-greenkeepered.

@gr2m
Copy link
Contributor

gr2m commented Jun 15, 2017

I think I got that, but isn’t it a problem with the dependency, which should update its peerDependency?

In the case of mozilla/normandy#235, would you like Greenkeeper to not send a PR for the new version of eslint-plugin-jsx-a11y at all until eslint-preset-airbnb updated its peerDependencies?

I think there is a big opportunity here for Greenkeeper to help eco systems like react or eslint which use peerDependencies a lot. We are still figuring out how we could be of best help :) Thanks for all your input

@ljharb
Copy link

ljharb commented Jun 16, 2017

no - for example, eslint-config-airbnb requires eslint 3. Any repo that's using eslint-config-airbnb must remain on eslint 3, but greenkeeper is bothering all of them with failing eslint v4 builds.

eslint-config-airbnb, perhaps, should update its peer dep, but zero consumers of eslint-config-airbnb should be getting a single notification until that time.

@travi
Copy link

travi commented Jun 16, 2017

i'm not sure that i agree that consumers should get no notification.

as a consumer, i think i would rather get the PR with some obvious way to understand the situation. that way i could look for and subscribe to any issues related to the progress of updates and understand why greenkeeper didnt send me an update when i see it in the output of npm outdated

@ljharb
Copy link

ljharb commented Jun 16, 2017

If you're using eslint-config-airbnb, it's mostly irrelevant to you that eslint updated (when the config can't support it). If greenkeeper wanted to file an issue notifying them that a dep of theirs has a peer dep that doesn't allow updating to the latest, and encourages them to comment on an upstream issue on that dep (that greenkeeper filed), that's great! PRs that automatically fail and can't be merged, however, are utterly useless noise.

Note that this is a particularly huge problem in any sub-ecosystem that uses peer deps - React, eslint, Angular, Ember, moment.js… just to name a few. As a maintainer of multiple libs in some of these ecosystems (eslint-config-airbnb/eslint-config-airbnb-base, enzyme, react-dates), the only thing that happens when a new major version of a peer dep comes out is that I get a horde of angry people filing disparate issues and PRs to naively update the dep, without actually making all the required changes necessary to make it work - when I am always fully aware that there's a new major version out. In the case of eslint v4, I filed airbnb/javascript#1447 to avoid the nightmare caused by eslint v2, which was much worse with v3 because greenkeeper was prevalent by then (with this same peer dep issue).

@travi
Copy link

travi commented Jun 16, 2017

filing an issue while avoiding the PR is a fair point. i agree about the noise from the PRs, but wouldn't want to be left in the dark in case i stumble upon the outdated dependency and then waste time trying to track down why it wasn't updated. having an issue logged would cover the point about keeping me informed, but i would also hope that the issue could be closed once the mismatch preventing the update has been resolved.

by the way, i'm a consumer of several of the libs you maintain and really appreciate the work you're doing, both with them and in conversations like these to help the community improve management of complex processes like this.

@gr2m
Copy link
Contributor

gr2m commented Jun 16, 2017

thanks for sharing your experiences / pains, much appreciated! That will definitely help us moving forward

kevinoid added a commit to kevinoid/node-project-template that referenced this issue Jan 26, 2020
Although it is preferable to keep @kevinoid/eslint-config up to date
(and will be warned about by david during preversion), it is not urgent
enough to warrant Greenkeeper opening PRs.  Especially ones which don't
update devDependencies to match the peerDependencies of
@kevinoid/eslint-config (possibly because they are ignored due to
greenkeeperio/greenkeeper#278).

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants