-
Notifications
You must be signed in to change notification settings - Fork 332
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
Respect peer dependencies #869
Conversation
e9c3425
to
68b92a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this PR is to fix #376.
@raineorshine Please have a look if this goes in the correct direction.
Thanks for your contribution!
- should the check be optional, what is default?
It should be opt-in via the --peer
option. Default ncu
behavior is intentionally kept very minimal so it is easy to reason about and there are no surprises.
- which warning should be raised if detection does not work? (the tests are currently failing due to this warning)
Can you explain more what you mean by "does not work"? Do you mean an upgrade breaks a peer dependency (expected), or do you mean the detection algorithm doesn't work in some cases (unexpected)? Are there other cases besides when packages have not yet been installed that you are thinking of?
Some other thoughts:
- Should
ncu
ignore breaking peer dependencies completely when this option is provided, or should it suggest the latest version that is compatible? Not sure what would be expected/most useful. - Unit test required
Thanks!
The
In fact, I think it's only relevant when a package is not installed locally. An upgrade should never break a peer dependency, since the purpose of this PR is to check this (see next comment).
My goal is that
I've added a test, now. The test uses a package |
Perfect! I will go ahead and remove those options since they are legacy and internal only.
That makes sense.
Yes! That would be great. |
I've added you as maintainer. We can remove me now or after this PR is merged. Whatever you prefer. |
Published in |
The purpose of this PR is to fix #376.
@raineorshine Please have a look if this goes in the correct direction. Open questions are, e.g.:
I've exported the new
getPeerDependencies
for the purpose that other tools can use it too, e.g. https://github.com/th0r/npm-upgrade