Skip to content

Commit 6feb42a

Browse files
committed
feat: add lockfile resolved options
1 parent 8027323 commit 6feb42a

File tree

4 files changed

+98
-0
lines changed

4 files changed

+98
-0
lines changed

lib/utils/config/definitions.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,3 +2267,33 @@ define('yes', {
22672267
the command line.
22682268
`,
22692269
})
2270+
2271+
define('omit-lockfile-registry-resolved', {
2272+
default: false,
2273+
type: Boolean,
2274+
description: `
2275+
Set to true to omit 'resolved' key from registry dependencies in lock files.
2276+
2277+
This setting is useful in projects that may install dependencies from
2278+
different registries but would use a lockfile to lock package versions.
2279+
This option makes installing slower because npm must fetch package manifest
2280+
to resolve the package version's tarball.
2281+
See 'record-default-registry' for an alternative.
2282+
`,
2283+
flatten,
2284+
})
2285+
2286+
define('record-default-registry', {
2287+
default: false,
2288+
type: Boolean,
2289+
description: `
2290+
Set to true to replace the actual registry in urls resolved from registires
2291+
with the default registry when recording lock files.
2292+
2293+
This setting is useful in projects that may install dependencies from
2294+
different registries but would use a lockfile to lock package versions.
2295+
This option supports registries that host tarballs at the same path. If
2296+
even the path may change see 'omit-lockfile-registry-resolved'.
2297+
`,
2298+
flatten,
2299+
})

tap-snapshots/test/lib/commands/config.js.test.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
156156
"workspace": [],
157157
"workspaces": null,
158158
"yes": null,
159+
"omit-lockfile-registry-resolved": false,
160+
"record-default-registry": false,
159161
"metrics-registry": "https://registry.npmjs.org/"
160162
}
161163
`
@@ -252,6 +254,7 @@ noproxy = [""]
252254
npm-version = "{NPM-VERSION}"
253255
offline = false
254256
omit = []
257+
omit-lockfile-registry-resolved = false
255258
only = null
256259
optional = null
257260
otp = null
@@ -269,6 +272,7 @@ progress = true
269272
proxy = null
270273
read-only = false
271274
rebuild-bundle = true
275+
record-default-registry = false
272276
registry = "https://registry.npmjs.org/"
273277
save = true
274278
save-bundle = false

tap-snapshots/test/lib/utils/config/definitions.js.test.cjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ Array [
152152
"workspace",
153153
"workspaces",
154154
"yes",
155+
"omit-lockfile-registry-resolved",
156+
"record-default-registry",
155157
]
156158
`
157159

@@ -1205,6 +1207,21 @@ If the resulting omit list includes \`'dev'\`, then the \`NODE_ENV\` environment
12051207
variable will be set to \`'production'\` for all lifecycle scripts.
12061208
`
12071209

1210+
exports[`test/lib/utils/config/definitions.js TAP > config description for omit-lockfile-registry-resolved 1`] = `
1211+
#### \`omit-lockfile-registry-resolved\`
1212+
1213+
* Default: false
1214+
* Type: Boolean
1215+
1216+
Set to true to omit 'resolved' key from registry dependencies in lock files.
1217+
1218+
This setting is useful in projects that may install dependencies from
1219+
different registries but would use a lockfile to lock package versions. This
1220+
option makes installing slower because npm must fetch package manifest to
1221+
resolve the package version's tarball. See 'record-default-registry' for an
1222+
alternative.
1223+
`
1224+
12081225
exports[`test/lib/utils/config/definitions.js TAP > config description for only 1`] = `
12091226
#### \`only\`
12101227
@@ -1394,6 +1411,21 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for rebui
13941411
Rebuild bundled dependencies after installation.
13951412
`
13961413

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

tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,22 @@ variable will be set to \`'production'\` for all lifecycle scripts.
10181018
<!-- automatically generated, do not edit manually -->
10191019
<!-- see lib/utils/config/definitions.js -->
10201020
1021+
#### \`omit-lockfile-registry-resolved\`
1022+
1023+
* Default: false
1024+
* Type: Boolean
1025+
1026+
Set to true to omit 'resolved' key from registry dependencies in lock files.
1027+
1028+
This setting is useful in projects that may install dependencies from
1029+
different registries but would use a lockfile to lock package versions. This
1030+
option makes installing slower because npm must fetch package manifest to
1031+
resolve the package version's tarball. See 'record-default-registry' for an
1032+
alternative.
1033+
1034+
<!-- automatically generated, do not edit manually -->
1035+
<!-- see lib/utils/config/definitions.js -->
1036+
10211037
#### \`otp\`
10221038
10231039
* Default: null
@@ -1188,6 +1204,22 @@ Rebuild bundled dependencies after installation.
11881204
<!-- automatically generated, do not edit manually -->
11891205
<!-- see lib/utils/config/definitions.js -->
11901206
1207+
#### \`record-default-registry\`
1208+
1209+
* Default: false
1210+
* Type: Boolean
1211+
1212+
Set to true to replace the actual registry in urls resolved from registires
1213+
with the default registry when recording lock files.
1214+
1215+
This setting is useful in projects that may install dependencies from
1216+
different registries but would use a lockfile to lock package versions. This
1217+
option supports registries that host tarballs at the same path. If even the
1218+
path may change see 'omit-lockfile-registry-resolved'.
1219+
1220+
<!-- automatically generated, do not edit manually -->
1221+
<!-- see lib/utils/config/definitions.js -->
1222+
11911223
#### \`registry\`
11921224
11931225
* Default: "https://registry.npmjs.org/"

0 commit comments

Comments
 (0)