-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RRFC] No auto-install for peerDependencies marked as optional #221
Comments
remyrylan
changed the title
[RRFC] Do not auto-install peerDependencies marked as optional.
[RRFC] Do not auto-install peerDependencies marked as optional
Sep 8, 2020
remyrylan
changed the title
[RRFC] Do not auto-install peerDependencies marked as optional
[RRFC] No auto-install for peerDependencies marked as optional
Sep 8, 2020
This has been implemented here: npm/arborist@e13ba3b The final decision was to go with treating |
Merged
4 tasks
7 tasks
This was referenced Jan 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivation ("The Why")
As a package author, I want to specify supported version ranges of
peerDependencies
. I also want to set some peers as optional withpeerDependenciesMeta
and{ "optional": true }
to avoid automatically installing them when an end-user installs a package I've authored.Example
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 even use.
How
Current Behaviour
npm v7 currently installs all
peerDependencies
, regardless if set as optional or not usingpeerDependenciesMeta
.Desired Behaviour
Personally, it seems ideal to me to not auto-install
peerDependencies
marked as optional. I believe it would be a massive benefit to the package ecosystem.peerDependencies
not marked as optional should still install automatically.References
The text was updated successfully, but these errors were encountered: