Skip to content

Commit 389f444

Browse files
committed
feat(config): Add --prune config option
1 parent de45f90 commit 389f444

14 files changed

+70
-42
lines changed

docs/content/commands/npm-dedupe.md

-4
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ this warning is treated as a failure.
135135
If set to false, then ignore `package-lock.json` files when installing. This
136136
will also prevent _writing_ `package-lock.json` if `save` is true.
137137
138-
When package package-locks are disabled, automatic pruning of extraneous
139-
modules will also be disabled. To remove extraneous modules with
140-
package-locks disabled use `npm prune`.
141-
142138
<!-- automatically generated, do not edit manually -->
143139
<!-- see lib/utils/config/definitions.js -->
144140

docs/content/commands/npm-find-dupes.md

-4
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ this warning is treated as a failure.
7878
If set to false, then ignore `package-lock.json` files when installing. This
7979
will also prevent _writing_ `package-lock.json` if `save` is true.
8080

81-
When package package-locks are disabled, automatic pruning of extraneous
82-
modules will also be disabled. To remove extraneous modules with
83-
package-locks disabled use `npm prune`.
84-
8581
<!-- automatically generated, do not edit manually -->
8682
<!-- see lib/utils/config/definitions.js -->
8783

docs/content/commands/npm-install-test.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,16 @@ this warning is treated as a failure.
129129
If set to false, then ignore `package-lock.json` files when installing. This
130130
will also prevent _writing_ `package-lock.json` if `save` is true.
131131

132-
When package package-locks are disabled, automatic pruning of extraneous
133-
modules will also be disabled. To remove extraneous modules with
134-
package-locks disabled use `npm prune`.
132+
<!-- automatically generated, do not edit manually -->
133+
<!-- see lib/utils/config/definitions.js -->
134+
135+
#### `prune`
136+
137+
* Default: true
138+
* Type: Boolean
139+
140+
When set to `false`, automatic pruning of extraneous modules will be
141+
disabled.
135142

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

docs/content/commands/npm-install.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,16 @@ this warning is treated as a failure.
513513
If set to false, then ignore `package-lock.json` files when installing. This
514514
will also prevent _writing_ `package-lock.json` if `save` is true.
515515
516-
When package package-locks are disabled, automatic pruning of extraneous
517-
modules will also be disabled. To remove extraneous modules with
518-
package-locks disabled use `npm prune`.
516+
<!-- automatically generated, do not edit manually -->
517+
<!-- see lib/utils/config/definitions.js -->
518+
519+
#### `prune`
520+
521+
* Default: true
522+
* Type: Boolean
523+
524+
When set to `false`, automatic pruning of extraneous modules will be
525+
disabled.
519526
520527
<!-- automatically generated, do not edit manually -->
521528
<!-- see lib/utils/config/definitions.js -->

docs/content/commands/npm-link.md

-4
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,6 @@ this warning is treated as a failure.
213213
If set to false, then ignore `package-lock.json` files when installing. This
214214
will also prevent _writing_ `package-lock.json` if `save` is true.
215215

216-
When package package-locks are disabled, automatic pruning of extraneous
217-
modules will also be disabled. To remove extraneous modules with
218-
package-locks disabled use `npm prune`.
219-
220216
<!-- automatically generated, do not edit manually -->
221217
<!-- see lib/utils/config/definitions.js -->
222218

docs/content/commands/npm-update.md

-4
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,6 @@ this warning is treated as a failure.
229229
If set to false, then ignore `package-lock.json` files when installing. This
230230
will also prevent _writing_ `package-lock.json` if `save` is true.
231231

232-
When package package-locks are disabled, automatic pruning of extraneous
233-
modules will also be disabled. To remove extraneous modules with
234-
package-locks disabled use `npm prune`.
235-
236232
<!-- automatically generated, do not edit manually -->
237233
<!-- see lib/utils/config/definitions.js -->
238234

docs/content/using-npm/config.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -1186,10 +1186,6 @@ The package to install for [`npm exec`](/commands/npm-exec)
11861186
If set to false, then ignore `package-lock.json` files when installing. This
11871187
will also prevent _writing_ `package-lock.json` if `save` is true.
11881188

1189-
When package package-locks are disabled, automatic pruning of extraneous
1190-
modules will also be disabled. To remove extraneous modules with
1191-
package-locks disabled use `npm prune`.
1192-
11931189
<!-- automatically generated, do not edit manually -->
11941190
<!-- see lib/utils/config/definitions.js -->
11951191

@@ -1293,6 +1289,17 @@ by the underlying `request` library.
12931289
<!-- automatically generated, do not edit manually -->
12941290
<!-- see lib/utils/config/definitions.js -->
12951291

1292+
#### `prune`
1293+
1294+
* Default: true
1295+
* Type: Boolean
1296+
1297+
When set to `false`, automatic pruning of extraneous modules will be
1298+
disabled.
1299+
1300+
<!-- automatically generated, do not edit manually -->
1301+
<!-- see lib/utils/config/definitions.js -->
1302+
12961303
#### `read-only`
12971304

12981305
* Default: false

lib/commands/install.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class Install extends ArboristWorkspaceCmd {
3333
'legacy-bundling',
3434
'strict-peer-deps',
3535
'package-lock',
36+
'prune',
3637
'omit',
3738
'ignore-scripts',
3839
'audit',

lib/utils/config/definitions.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -1396,10 +1396,6 @@ define('package-lock', {
13961396
If set to false, then ignore \`package-lock.json\` files when installing.
13971397
This will also prevent _writing_ \`package-lock.json\` if \`save\` is
13981398
true.
1399-
1400-
When package package-locks are disabled, automatic pruning of extraneous
1401-
modules will also be disabled. To remove extraneous modules with
1402-
package-locks disabled use \`npm prune\`.
14031399
`,
14041400
flatten: (key, obj, flatOptions) => {
14051401
flatten(key, obj, flatOptions)
@@ -1530,6 +1526,16 @@ define('proxy', {
15301526
flatten,
15311527
})
15321528

1529+
define('prune', {
1530+
default: true,
1531+
type: Boolean,
1532+
description: `
1533+
When set to \`false\`, automatic pruning of extraneous
1534+
modules will be disabled.
1535+
`,
1536+
flatten,
1537+
})
1538+
15331539
define('read-only', {
15341540
default: false,
15351541
type: Boolean,

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

+2
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
115115
"production": null,
116116
"progress": true,
117117
"proxy": null,
118+
"prune": true,
118119
"read-only": false,
119120
"rebuild-bundle": true,
120121
"registry": "https://registry.npmjs.org/",
@@ -267,6 +268,7 @@ preid = ""
267268
production = null
268269
progress = true
269270
proxy = null
271+
prune = true
270272
read-only = false
271273
rebuild-bundle = true
272274
registry = "https://registry.npmjs.org/"

tap-snapshots/test/lib/load-all-commands.js.test.cjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ npm install <github username>/<github project>
448448
Options:
449449
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer]
450450
[-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
451-
[--strict-peer-deps] [--no-package-lock]
451+
[--strict-peer-deps] [--no-package-lock] [--no-prune]
452452
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
453453
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
454454
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
@@ -495,7 +495,7 @@ npm install-test <github username>/<github project>
495495
Options:
496496
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer]
497497
[-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
498-
[--strict-peer-deps] [--no-package-lock]
498+
[--strict-peer-deps] [--no-package-lock] [--no-prune]
499499
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
500500
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
501501
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]

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

+11-4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ Array [
110110
"production",
111111
"progress",
112112
"proxy",
113+
"prune",
113114
"read-only",
114115
"rebuild-bundle",
115116
"registry",
@@ -1267,10 +1268,6 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for packa
12671268
12681269
If set to false, then ignore \`package-lock.json\` files when installing. This
12691270
will also prevent _writing_ \`package-lock.json\` if \`save\` is true.
1270-
1271-
When package package-locks are disabled, automatic pruning of extraneous
1272-
modules will also be disabled. To remove extraneous modules with
1273-
package-locks disabled use \`npm prune\`.
12741271
`
12751272

12761273
exports[`test/lib/utils/config/definitions.js TAP > config description for package-lock-only 1`] = `
@@ -1375,6 +1372,16 @@ A proxy to use for outgoing http requests. If the \`HTTP_PROXY\` or
13751372
by the underlying \`request\` library.
13761373
`
13771374

1375+
exports[`test/lib/utils/config/definitions.js TAP > config description for prune 1`] = `
1376+
#### \`prune\`
1377+
1378+
* Default: true
1379+
* Type: Boolean
1380+
1381+
When set to \`false\`, automatic pruning of extraneous modules will be
1382+
disabled.
1383+
`
1384+
13781385
exports[`test/lib/utils/config/definitions.js TAP > config description for read-only 1`] = `
13791386
#### \`read-only\`
13801387

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

+11-4
Original file line numberDiff line numberDiff line change
@@ -1060,10 +1060,6 @@ The package to install for [\`npm exec\`](/commands/npm-exec)
10601060
If set to false, then ignore \`package-lock.json\` files when installing. This
10611061
will also prevent _writing_ \`package-lock.json\` if \`save\` is true.
10621062
1063-
When package package-locks are disabled, automatic pruning of extraneous
1064-
modules will also be disabled. To remove extraneous modules with
1065-
package-locks disabled use \`npm prune\`.
1066-
10671063
<!-- automatically generated, do not edit manually -->
10681064
<!-- see lib/utils/config/definitions.js -->
10691065
@@ -1167,6 +1163,17 @@ by the underlying \`request\` library.
11671163
<!-- automatically generated, do not edit manually -->
11681164
<!-- see lib/utils/config/definitions.js -->
11691165
1166+
#### \`prune\`
1167+
1168+
* Default: true
1169+
* Type: Boolean
1170+
1171+
When set to \`false\`, automatic pruning of extraneous modules will be
1172+
disabled.
1173+
1174+
<!-- automatically generated, do not edit manually -->
1175+
<!-- see lib/utils/config/definitions.js -->
1176+
11701177
#### \`read-only\`
11711178
11721179
* Default: false

tap-snapshots/test/lib/utils/npm-usage.js.test.cjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ All commands:
557557
Options:
558558
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer]
559559
[-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
560-
[--strict-peer-deps] [--no-package-lock]
560+
[--strict-peer-deps] [--no-package-lock] [--no-prune]
561561
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
562562
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
563563
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
@@ -600,7 +600,7 @@ All commands:
600600
Options:
601601
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer]
602602
[-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
603-
[--strict-peer-deps] [--no-package-lock]
603+
[--strict-peer-deps] [--no-package-lock] [--no-prune]
604604
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
605605
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
606606
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]

0 commit comments

Comments
 (0)