-
I have a question about auto-installing peer dependencies. In this PR @isaacs mentions that:
while the Install Peer Dependencies RFC states that:
I'm not sure if there's a contradiction, or am I missing something? Currently, it causes some problems, which I'm not sure how to get around properly: I created a simple repo: https://github.com/jansiegel/npm7-peerDeps-test It has workspaces enabled and consists of 2 packages:
When calling
From what I understand, correct me if I'm wrong:
An even simpler example would be:
Is there any way to get around it? I can easily imagine a monorepo with |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey @jansiegel, I've transferred this discussion to the RFC repo as it is about a specific RFC as opposed to a specific feature request. Also pinged the CLI team to take a look. |
Beta Was this translation helpful? Give feedback.
-
Subtle distinction: "in" vs "at". If
Thus, if
Perhaps "top" packages (ie, those outside of a The caveat would be that if you have a bunch of workspaces which you want to all use the same singleton peerDep, you could easily end up with some of them on different versions. This could even happen as a result of meta-dependencies. For example, say you have 5 projects peer-depending on
So, even though your workspace loads just fine, your set of packages do not all work together properly, because they have conflicting peer deps that are being obscured by the fact that we treat them all like independent universes. There would be no way to know that installing While workspaces are independent projects, they're assumed to be related projects. For example, we do our best to ensure that if |
Beta Was this translation helpful? Give feedback.
Subtle distinction: "in" vs "at".
If
foo
has a peerDep onbar
, andfoo
is installed at.../node_modules/foo
then we may not installbar
at.../node_modules/foo/node_modules/bar
. That would be "in" foo as the "target" in the terminology used within Arborist. It must be placed at foo's level or higher. Ie, at.../node_modules/bar
o…