-
Notifications
You must be signed in to change notification settings - Fork 335
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
packages peer dependencies ignored when suggesting updates #80
Comments
I am not familiar with how peerDependencies work, so I will have to investigate. Should npm-check-updates ignore peerDependencies? Any suggestions you have are appreciated. |
peerDependencies specify other packages that need to be present but aren't required directly from the current package. npm-check-updates should account for this when it recommends updated versions of the package. in my example npm-check-updates suggested that I update to |
I imagine you meant |
That's the one |
This feature would be great to have. I just spent about 10 minutes trying to figure out what's going on with something I'm working on and this would have caught it immediately. As far as functionality, I can't see why it shouldn't treat peer dependencies exactly the same as regular or dev dependencies. |
👍 |
The purpose of npm-check-updates is to suggest breaking changes. If it didn't, we would just use npm update. Even if you make a sensible argument for certain constraints on peer dependencies I would be resistant to implementing it as it changes that fundamental purpose of npm-check-updates: to show you the latest versions, disregarding version numbers while preserving version patterns. It's a bit counterintuitive since the purpose of npm itself is the opposite: to prevent breaking changes. Regarding the suggestion to update peerDependencies themselves, this is not recommended due to another counterintuitive aspect of peerDependencies: you want peerDependencies to be as loose as possible. If your module is compatible with OtherModule v1.x, then changing the dependency to v3.x would suddenly warn that it was incompatible with earlier versions, even if it was compatible. Just because there is a breaking change doesn't mean that the entire API has changed. Thus, incompatibilities between peer dependencies must be manually resolved by a human anyway. It is unfortunate that peerDependencies are so problematic. |
@metaraine That's a fair point. I guess I am just used to npm-check-updates not actually breaking anything. 😜 |
Why not suggest peer updates instead of doing them? It won't break anything but will be very useful. Because now I have to move peerDependencies to devDevdependencies, update them with ncu and then move back... |
Hi, @raineorshine! Thanks for the option, I updated to 2.12.0 but it does not seem to work. My package.json: {
"name": "xxx",
"version": "3.0.3",
"description": "xxx",
"main": "index.js",
"scripts": {
},
"author": "",
"license": "ISC",
"dependencies": {
"amqp": "^0.2.6",
"bluebird": "^3.5.0",
"body-parser": "^1.17.1",
"clone": "^2.1.1",
"exec": "^0.2.1",
"express": "^4.15.2",
"express-pass-id": "^0.0.2",
"knex": "^0.13.0",
"logfox": "^0.2.15",
"mask-sensitive": "0.0.4",
"moment": "^2.17.1",
"mongodb": "^2.2.24",
"node-tlv": "^1.5.5",
"object-assign": "^4.1.1",
"pg": "^6.1.4",
"raw-body": "^2.2.0",
"request": "^2.81.0",
"request-promise": "^4.2.1",
"simple-promise-queue": "^0.1.7",
"sprintf-js": "^1.0.3",
"tlv": "^1.1.1",
"trim-left-zero": "0.1.0",
"underscore": "^1.8.3",
"validator": "^7.0.0"
},
"peerDependencies": {
"babel-cli": "^6.23.0",
"babel-preset-es2015": "^6.22.0",
"eslint": "^3.16.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-promise": "^3.4.2",
"eslint-plugin-react": "^6.10.0",
"eslint-plugin-standard": "^2.0.1"
},
"devDependencies": {
"mocha": "^3.2.0"
}
} When I use
but if I move my peerDependencies to devDependencies, I see that there are packages which should be updated (all eslint*):
|
@jehy Ack! You are right! It even got around my unit test. I wasn't passing the --peer flag through correctly. Try |
Yup, 2.12.1 works just as supposed, thanks! |
👍 |
Hi, i just wanted to inquire about what ncu would do if i run it in the following scenario, suppose my package.json looks something like this: "dependencies": { and dependency "A" has specified a peer dependency on X as: so if i run NCU on this , will the updated package result returned to me take the peer dependency issue into account , and suggest me to upgrade X to ^2.3.0 ? |
Currently ncu does not take peerDependencies into account. It is harder than it looks and handling them automatically is not obviously the correct choice, as I described in #80 (comment). (Side note: If X is a There is certainly value in notifying the user about broken peerDependencies. I could even see an optional flag to only upgrade packages in a way that doesn't break peerDependencies. These could be good enhancements. But I remain cautious about complicating the logic of The purpose of ncu is to break your code and peerDependencies by upgrading them to the latest. This would be the most intuitive stance to adopt. |
Yes, that is correct.
…On Thu, Jul 5, 2018 at 12:20 AM kushmisra ***@***.***> wrote:
Thanks @raineorshine <https://github.com/raineorshine> !. and yes its
harder than it appears. So, just for confirmation , currently using
--jsonAll or --jsonUpgraded will give me packages such that it may *break*
the peerDependencies. So just blindly using the package.json suggested by
the above flags can infact break my code , due to peerDependencies mismath ?
The problem due to which this issue was raised ie:-
For example ***@***.*** has a peer dependency of chai >= 2.1.2
< 3 but after checking for updates ***@***.*** was suggested.
this will still exist with the result i get after using ncu?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#80 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAtyxPW5gZgHlQVXphAJtBqQI1ZEWnAZks5uDbAmgaJpZM4E4U8a>
.
|
I have the same issue. My Would be cool to have a |
@kopax You can effectively ignore |
How can I only update prod and dev ? is it |
Yes, it is |
Ok. I now got it, this module is really helpful, thanks! |
@raineorshine sorry to be struggling that much, I am typing:
I have also tried
|
@kopax I tried the command |
For example
[email protected]
has a peer dependency ofchai >= 2.1.2 < 3
but after checking for updates[email protected]
was suggested.The text was updated successfully, but these errors were encountered: