-
Notifications
You must be signed in to change notification settings - Fork 247
Description
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 with peerDependenciesMeta 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 using peerDependenciesMeta.
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
- n/a