-
Notifications
You must be signed in to change notification settings - Fork 243
RFC: No auto-install for peerDependencies marked as optional #224
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
I've been clear that we won't change the peer dependencies default behavior (ie they won't be auto-installed), so in our case this probably won't affect us. |
As you can see in #43 and microsoft/types-publisher#655 (comment), I've made it clear that I had significant concerns about RFC 25. I don't think the critical points raised were addressed, and as a result I don't think it would be reasonable to implement it. |
I as well wasn't planning to implement #43 in pnpm. If users will demand it, I might consider some solutions. This RFC seems fine |
ooops, we should merge/accept here too, reopening |
@ruyadorno I'll remove the Edit: Done! |
Thanks for the contribution @jrylan 😄 |
Summary
Avoid automatically installing
peerDependencies
marked as optional usingpeerDependenciesMeta
and{ "optional": true }
.Motivation
Package authors want to specify supported version ranges of
peerDependencies
. They also want to set some peers as optional withpeerDependenciesMeta
and{ "optional": true }
to avoid automatically installing them when an end-user installs their package.As an example, let's take a database ORM package. The ORM package could support upwards of a dozen different databases and require an end-user to install the database adapter(s) needed for their project. These database adapters could be huge and could have
peerDependencies
,postinstall
scripts, and other requirements.It could significantly bloat a project's install time and dependency tree to pull in tons of packages that an end-developer would never use.
Detailed Explanation
When a peer dependency is marked as
{ "optional": true }
usingpeerDependenciesMeta
, it should not install automatically.peerDependencies
without apeerDependenciesMeta
value of{ "optional": true }
should still install automatically.Example
package.json
References
Related to #221
Fixes #221
Closes #221