Skip to content

Commit 56a688a

Browse files
committed
add the --legacy-peer-deps config
1 parent 8749628 commit 56a688a

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

docs/content/using-npm/config.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,25 @@ such as the one included with node 0.8, can install the package. This
644644
eliminates all automatic deduping. If used with `global-style` this option
645645
will be preferred.
646646

647+
#### legacy-peer-deps
648+
649+
* Default: false
650+
* Type: Boolean
651+
652+
Causes npm to completely ignore `peerDependencies` when building a package
653+
tree, as in npm versions 3 through 6.
654+
655+
If a package cannot be installed because of overly strict
656+
`peerDependencies` that collide, it provides a way to move forward
657+
resolving the situation.
658+
659+
This differs from `--omit=peer`, in that `--omit=peer` will avoid unpacking
660+
`peerDependencies` on disk, but will still design a tree such that
661+
`peerDependencies` _could_ be unpacked in a correct place.
662+
663+
Use of `legacy-peer-deps` is not recommended, as it will not enforce the
664+
`peerDependencies` contract that meta-dependencies may rely on.
665+
647666
#### link
648667

649668
* Default: false

lib/config/defaults.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ Object.defineProperty(exports, 'defaults', {get: function () {
171171
json: false,
172172
key: null,
173173
'legacy-bundling': false,
174+
'legacy-peer-deps': false,
174175
link: false,
175176
'local-address': undefined,
176177
loglevel: 'notice',
@@ -316,6 +317,7 @@ exports.types = {
316317
json: Boolean,
317318
key: [null, String],
318319
'legacy-bundling': Boolean,
320+
'legacy-peer-deps': Boolean,
319321
link: Boolean,
320322
'local-address': getLocalAddresses(),
321323
loglevel: ['silent', 'error', 'warn', 'notice', 'http', 'timing', 'info', 'verbose', 'silly'],

lib/config/flat-options.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ const flatOptions = npm => npm.flatOptions || Object.freeze({
165165
legacyBundling: npm.config.get('legacy-bundling'),
166166
scriptShell: npm.config.get('script-shell') || undefined,
167167
omit: buildOmitList(npm),
168+
legacyPeerDeps: npm.config.get('legacy-peer-deps'),
168169

169170
// used to build up the appropriate {add:{...}} options to Arborist.reify
170171
save: npm.config.get('save'),

0 commit comments

Comments
 (0)