Uh oh!
There was an error while loading. Please reload this page.
RFC: No auto-install for peerDependencies marked as optional - #224
RFC: No auto-install for peerDependencies marked as optional#224RemyRylan wants to merge 2 commits into
Conversation
RemyRylan
commented
Sep 17, 2020
arcanis
commented
Sep 17, 2020
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. |
arcanis
commented
Sep 17, 2020
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. |
zkochan
commented
Sep 17, 2020
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 |
ruyadorno
commented
Sep 23, 2020
ooops, we should merge/accept here too, reopening |
@ruyadorno I'll remove the Edit: Done! |
ruyadorno
commented
Sep 23, 2020
Thanks for the contribution @jrylan 😄 |
Summary
Avoid automatically installing
peerDependenciesmarked as optional usingpeerDependenciesMetaand{ "optional": true }.Motivation
Package authors want to specify supported version ranges of
peerDependencies. They also want to set some peers as optional withpeerDependenciesMetaand{ "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,postinstallscripts, 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.peerDependencieswithout apeerDependenciesMetavalue of{ "optional": true }should still install automatically.Example
package.json{ "peerDependencies": { "react": "^17.0.0" }, "peerDependenciesMeta": { "react": { "optional": true } } }References
Related to #221
Fixes#221
Closes#221