Skip to content

Commit

Permalink
feat: add lockfile resolved options
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb ツ Everett committed Apr 4, 2022
1 parent db5ca7b commit 99de719
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,22 @@ variable will be set to `'production'` for all lifecycle scripts.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->

#### `omit-lockfile-registry-resolved`

* Default: false
* Type: Boolean

Set to true to omit 'resolved' key from registry dependencies in lock files.

This setting is useful in projects that may install dependencies from
different registries but would use a lockfile to lock package versions. This
option makes installing slower because npm must fetch package manifest to
resolve the package version's tarball. See 'record-default-registry' for an
alternative.

<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->

#### `otp`

* Default: null
Expand Down Expand Up @@ -1333,6 +1349,22 @@ Rebuild bundled dependencies after installation.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->

#### `record-default-registry`

* Default: false
* Type: Boolean

Set to true to replace the actual registry in urls resolved from registires
with the default registry when recording lock files.

This setting is useful in projects that may install dependencies from
different registries but would use a lockfile to lock package versions. This
option supports registries that host tarballs at the same path. If even the
path may change see 'omit-lockfile-registry-resolved'.

<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->

#### `registry`

* Default: "https://registry.npmjs.org/"
Expand Down
30 changes: 30 additions & 0 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2304,3 +2304,33 @@ define('yes', {
the command line.
`,
})

define('omit-lockfile-registry-resolved', {
default: false,
type: Boolean,
description: `
Set to true to omit 'resolved' key from registry dependencies in lock files.
This setting is useful in projects that may install dependencies from
different registries but would use a lockfile to lock package versions.
This option makes installing slower because npm must fetch package manifest
to resolve the package version's tarball.
See 'record-default-registry' for an alternative.
`,
flatten,
})

define('record-default-registry', {
default: false,
type: Boolean,
description: `
Set to true to replace the actual registry in urls resolved from registires
with the default registry when recording lock files.
This setting is useful in projects that may install dependencies from
different registries but would use a lockfile to lock package versions.
This option supports registries that host tarballs at the same path. If
even the path may change see 'omit-lockfile-registry-resolved'.
`,
flatten,
})
4 changes: 4 additions & 0 deletions tap-snapshots/test/lib/commands/config.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"workspaces": null,
"workspaces-update": true,
"yes": null,
"omit-lockfile-registry-resolved": false,
"record-default-registry": false,
"metrics-registry": "https://registry.npmjs.org/"
}
`
Expand Down Expand Up @@ -255,6 +257,7 @@ noproxy = [""]
npm-version = "{NPM-VERSION}"
offline = false
omit = []
omit-lockfile-registry-resolved = false
only = null
optional = null
otp = null
Expand All @@ -272,6 +275,7 @@ progress = true
proxy = null
read-only = false
rebuild-bundle = true
record-default-registry = false
registry = "https://registry.npmjs.org/"
save = true
save-bundle = false
Expand Down
32 changes: 32 additions & 0 deletions tap-snapshots/test/lib/utils/config/definitions.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ Array [
"workspaces",
"workspaces-update",
"yes",
"omit-lockfile-registry-resolved",
"record-default-registry",
]
`

Expand Down Expand Up @@ -1223,6 +1225,21 @@ If the resulting omit list includes \`'dev'\`, then the \`NODE_ENV\` environment
variable will be set to \`'production'\` for all lifecycle scripts.
`

exports[`test/lib/utils/config/definitions.js TAP > config description for omit-lockfile-registry-resolved 1`] = `
#### \`omit-lockfile-registry-resolved\`
* Default: false
* Type: Boolean
Set to true to omit 'resolved' key from registry dependencies in lock files.
This setting is useful in projects that may install dependencies from
different registries but would use a lockfile to lock package versions. This
option makes installing slower because npm must fetch package manifest to
resolve the package version's tarball. See 'record-default-registry' for an
alternative.
`

exports[`test/lib/utils/config/definitions.js TAP > config description for only 1`] = `
#### \`only\`
Expand Down Expand Up @@ -1414,6 +1431,21 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for rebui
Rebuild bundled dependencies after installation.
`

exports[`test/lib/utils/config/definitions.js TAP > config description for record-default-registry 1`] = `
#### \`record-default-registry\`
* Default: false
* Type: Boolean
Set to true to replace the actual registry in urls resolved from registires
with the default registry when recording lock files.
This setting is useful in projects that may install dependencies from
different registries but would use a lockfile to lock package versions. This
option supports registries that host tarballs at the same path. If even the
path may change see 'omit-lockfile-registry-resolved'.
`

exports[`test/lib/utils/config/definitions.js TAP > config description for registry 1`] = `
#### \`registry\`
Expand Down
32 changes: 32 additions & 0 deletions tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,22 @@ variable will be set to \`'production'\` for all lifecycle scripts.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
#### \`omit-lockfile-registry-resolved\`
* Default: false
* Type: Boolean
Set to true to omit 'resolved' key from registry dependencies in lock files.
This setting is useful in projects that may install dependencies from
different registries but would use a lockfile to lock package versions. This
option makes installing slower because npm must fetch package manifest to
resolve the package version's tarball. See 'record-default-registry' for an
alternative.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
#### \`otp\`
* Default: null
Expand Down Expand Up @@ -1207,6 +1223,22 @@ Rebuild bundled dependencies after installation.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
#### \`record-default-registry\`
* Default: false
* Type: Boolean
Set to true to replace the actual registry in urls resolved from registires
with the default registry when recording lock files.
This setting is useful in projects that may install dependencies from
different registries but would use a lockfile to lock package versions. This
option supports registries that host tarballs at the same path. If even the
path may change see 'omit-lockfile-registry-resolved'.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
#### \`registry\`
* Default: "https://registry.npmjs.org/"
Expand Down

0 comments on commit 99de719

Please sign in to comment.