RFC: No auto-install for peerDependencies marked as optional#224
Closed
RemyRylan wants to merge 2 commits intonpm:latestfrom
RemyRylan:latest
Closed
RFC: No auto-install for peerDependencies marked as optional#224RemyRylan wants to merge 2 commits intonpm:latestfrom RemyRylan:latest
RemyRylan wants to merge 2 commits intonpm:latestfrom
RemyRylan:latest
Conversation
Contributor
Author
|
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 |
Contributor
|
ooops, we should merge/accept here too, reopening |
Contributor
Author
|
@ruyadorno I'll remove the Edit: Done! |
Contributor
|
Thanks for the contribution @jrylan 😄 |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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