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

Library should not update peerDependencies #951

Closed
3 tasks done
ehaynes99 opened this issue Sep 28, 2021 · 3 comments
Closed
3 tasks done

Library should not update peerDependencies #951

ehaynes99 opened this issue Sep 28, 2021 · 3 comments

Comments

@ehaynes99
Copy link

  • I have searched for similar issues
  • I am using the latest version of npm-check-updates
  • I am using node >= 10.17

When running npm-check-updates, it updates versions in peerDependencies by default. This is fundamentally wrong. When using peerDependencies, you should always try to select the most permissive version possible, i.e. the lowest possible version that works. Where possible, it's even better to have multiple major versions as options. Setting this unnecessarily high makes the library overly restrictive, maximizing the chance of a conflict with the consuming project's dependencies, thus minimizing its utility.

E.g. If I create a component library for React that uses hooks (introduced in 16.8), the ideal values would be:

"peerDependencies": {
  "react": "^16.8.0 || ^17.0.0"
},
"devDependencies: {
  "react": "^17.0.2",

or for a library supplementing jest, it should have:

"peerDependencies": {
  "jest": "^24.0.0 || ^25.0.0 || ^26.0.0 || ^27.0.0"
},
"devDependencies: {
  "jest": "^27.2.3",
  ...

I realize that I can use the --dep flag for this, but there really isn't a valid case for maximizing this value...

@raineorshine
Copy link
Owner

That makes a lot of sense. Thanks for the explanation! I think we should change the default behavior to exclude peerDependencies on the next major version.

@raineorshine
Copy link
Owner

Fixed and published in v12.0.0.

@mesqueeb
Copy link

mesqueeb commented Jan 4, 2022

@raineorshine just wanna say big thank you!! < 3

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

3 participants