Skip to content

Add --strict-peer-deps option #1819

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,24 @@ should be polled while the user is completing authentication.

If `--auth-type=sso`, the type of SSO type to use.

#### strict-peer-deps

* Default: false
* Type: Boolean

If set to `true`, and `--legacy-peer-deps` is not set, then _any_
conflicting `peerDependencies` will be treated as an install failure, even
if npm could reasonably guess the appropriate resolution based on non-peer
dependency relationships.

By default, conflicting `peerDependencies` in the dependency graph will be
resolved using the nearest non-peer dependency specification, even if doing
so will result in some packages receiving a peer dependency outside the
range set in their package's `peerDependencies` object. When such and
override is performed, a warning is printed, explaining the conflict and
the packages involved. If `--strict-peer-deps` is set, then the warning is
treated as a failure.

#### strict-ssl

* Default: true
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const defaults = {
key: null,
'legacy-bundling': false,
'legacy-peer-deps': false,
'strict-peer-deps': false,
link: false,
'local-address': undefined,
loglevel: 'notice',
Expand Down Expand Up @@ -229,7 +230,6 @@ const types = {
group: [Number, String],
'https-proxy': [null, url],
'user-agent': String,
'ham-it-up': Boolean,
heading: String,
'if-present': Boolean,
include: [Array, 'prod', 'dev', 'optional', 'peer'],
Expand All @@ -246,6 +246,7 @@ const types = {
key: [null, String],
'legacy-bundling': Boolean,
'legacy-peer-deps': Boolean,
'strict-peer-deps': Boolean,
link: Boolean,
'local-address': getLocalAddresses(),
loglevel: [
Expand Down
1 change: 1 addition & 0 deletions lib/utils/flat-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ const flatOptions = npm => npm.flatOptions || Object.freeze({
shell: npm.config.get('shell'),
omit: buildOmitList(npm),
legacyPeerDeps: npm.config.get('legacy-peer-deps'),
strictPeerDeps: npm.config.get('strict-peer-deps'),

// npx stuff
call: npm.config.get('call'),
Expand Down
9 changes: 6 additions & 3 deletions tap-snapshots/test-lib-utils-config.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Object {
"sign-git-tag": false,
"sso-poll-frequency": 500,
"sso-type": "oauth",
"strict-peer-deps": false,
"strict-ssl": true,
"tag": "latest",
"tag-version-prefix": "v",
Expand Down Expand Up @@ -347,7 +348,6 @@ Object {
"{Number TYPE}",
"{String TYPE}",
],
"ham-it-up": "{Boolean TYPE}",
"heading": "{String TYPE}",
"https-proxy": Array [
null,
Expand Down Expand Up @@ -495,6 +495,7 @@ Object {
"oauth",
"saml",
],
"strict-peer-deps": "{Boolean TYPE}",
"strict-ssl": "{Boolean TYPE}",
"tag": "{String TYPE}",
"tag-version-prefix": "{String TYPE}",
Expand Down Expand Up @@ -625,6 +626,7 @@ Object {
"sign-git-tag": false,
"sso-poll-frequency": 500,
"sso-type": "oauth",
"strict-peer-deps": false,
"strict-ssl": true,
"tag": "latest",
"tag-version-prefix": "v",
Expand Down Expand Up @@ -855,7 +857,6 @@ Object {
"{Number TYPE}",
"{String TYPE}",
],
"ham-it-up": "{Boolean TYPE}",
"heading": "{String TYPE}",
"https-proxy": Array [
null,
Expand Down Expand Up @@ -1003,6 +1004,7 @@ Object {
"oauth",
"saml",
],
"strict-peer-deps": "{Boolean TYPE}",
"strict-ssl": "{Boolean TYPE}",
"tag": "{String TYPE}",
"tag-version-prefix": "{String TYPE}",
Expand Down Expand Up @@ -1133,6 +1135,7 @@ Object {
"sign-git-tag": false,
"sso-poll-frequency": 500,
"sso-type": "oauth",
"strict-peer-deps": false,
"strict-ssl": true,
"tag": "latest",
"tag-version-prefix": "v",
Expand Down Expand Up @@ -1363,7 +1366,6 @@ Object {
"{Number TYPE}",
"{String TYPE}",
],
"ham-it-up": "{Boolean TYPE}",
"heading": "{String TYPE}",
"https-proxy": Array [
null,
Expand Down Expand Up @@ -1513,6 +1515,7 @@ Object {
"oauth",
"saml",
],
"strict-peer-deps": "{Boolean TYPE}",
"strict-ssl": "{Boolean TYPE}",
"tag": "{String TYPE}",
"tag-version-prefix": "{String TYPE}",
Expand Down
1 change: 1 addition & 0 deletions tap-snapshots/test-lib-utils-flat-options.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Object {
"signGitTag": "sign-git-tag",
"ssoPollFrequency": undefined,
"ssoType": undefined,
"strictPeerDeps": undefined,
"strictSSL": "strict-ssl",
"tag": "tag",
"tagVersionPrefix": "tag-version-prefix",
Expand Down