Replies: 9 comments 5 replies
-
So let’s say the project with this field is eslint, which should generally be a peer dep. what about the end users who need to install it as a dev dep? Let’s say it’s react - what about the end users who need to install it as a dep? |
Beta Was this translation helpful? Give feedback.
-
@ljharb That's why I'm speaking about a recommandation and a notification, the goal isn't to enforce it. ;) |
Beta Was this translation helpful? Give feedback.
-
Interesting question... because even if you're right about the beginners, they might not understand some bugs caused by different instances of a common dependency where they should have an unique. This discuss can maybe weigh these 2 (or more) problems. :) |
Beta Was this translation helpful? Give feedback.
-
In any case, I think useful to have something to indicate that recommanded behavior, for these experimented users, without the need to search if it's needed. Maybe flagged by something like a peer icon that switches between |
Beta Was this translation helpful? Give feedback.
-
I almost approve, but the package author has the context to know if it can be a source of problems. I think there is 2 package types: projects creating some specific references (constructors, prototypes, etc.) that can be generally compared against multiple dependencies/project or not. |
Beta Was this translation helpful? Give feedback.
-
Hey @npm/cli any thoughts on this? |
Beta Was this translation helpful? Give feedback.
-
So, this is a bit like In practice, paradoxically, the package author is generally less able to identify how something needs to be installed than the package consumer. There are many cases where The assumption that something will always be a peer dep is a big part of why If you think that your package should usually or typically be a peer dep, that's fine. Put it in your documentation. Experienced users will know when they are an exception. However, if we post a warning about it whenever we see If you must insist that your package is a singleton in a given run environment, there are ways to do this. Just do what React and others do: set a global value, and check for it. Throw an informative error if some other instance already set it. Doing this at the package manager level is a bit too presumptuous, and carries much more hazard than one might guess. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your feelings. The idea isn't to enforce anything, just annoyed be the "Put it in your documentation." for something related to the install process which is common on many projects. I didn't deny the doc role for that but the docs aren't always written in the same manner, then the users must search about it... that's the point I dislike. |
Beta Was this translation helpful? Give feedback.
-
It's ok, I finally opted for a specific badge I created... since by convention, the badges are always used on top of a readme. Feel free to use it too. :) https://github.com/Lcfvs/library-peer PS: Sorry for the disturbing |
Beta Was this translation helpful? Give feedback.
-
Hi,
Since V7 supports
--save-peer
, I think it would be paired with a related feature and implications:npm install xxx
, on the NPM website, if that field is present.What do you think about, it, please?
Beta Was this translation helpful? Give feedback.
All reactions