Skip to content

Commit bedd8a1

Browse files
nlflukekarrys
authored andcommitted
feat: add install-links config definition
1 parent a4adf25 commit bedd8a1

File tree

9 files changed

+74
-56
lines changed

9 files changed

+74
-56
lines changed

docs/content/using-npm/config.md

+12
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,18 @@ number, if not already set in package.json.
891891
<!-- automatically generated, do not edit manually -->
892892
<!-- see lib/utils/config/definitions.js -->
893893

894+
#### `install-links`
895+
896+
* Default: false
897+
* Type: Boolean
898+
899+
When set file: protocol dependencies that exist outside of the project root
900+
will be packed and installed as regular dependencies instead of creating a
901+
symlink. This option has no effect on workspaces.
902+
903+
<!-- automatically generated, do not edit manually -->
904+
<!-- see lib/utils/config/definitions.js -->
905+
894906
#### `json`
895907

896908
* Default: false

lib/arborist-cmd.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class ArboristCmd extends BaseCommand {
1212
'workspace',
1313
'workspaces',
1414
'include-workspace-root',
15+
'install-links',
1516
]
1617

1718
static ignoreImplicitWorkspace = false

lib/utils/config/definitions.js

+11
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,17 @@ define('init.version', {
10701070
`,
10711071
})
10721072

1073+
define('install-links', {
1074+
default: false,
1075+
type: Boolean,
1076+
description: `
1077+
When set file: protocol dependencies that exist outside of the project root
1078+
will be packed and installed as regular dependencies instead of creating a
1079+
symlink. This option has no effect on workspaces.
1080+
`,
1081+
flatten,
1082+
})
1083+
10731084
define('json', {
10741085
default: false,
10751086
type: Boolean,

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

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
8181
"init.license": "ISC",
8282
"init.module": "{HOME}/.npm-init.js",
8383
"init.version": "1.0.0",
84+
"install-links": false,
8485
"key": null,
8586
"legacy-bundling": false,
8687
"legacy-peer-deps": false,
@@ -234,6 +235,7 @@ init.author.url = ""
234235
init.license = "ISC"
235236
init.module = "{HOME}/.npm-init.js"
236237
init.version = "1.0.0"
238+
install-links = false
237239
json = false
238240
key = null
239241
legacy-bundling = false

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

-32
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,6 @@ [email protected]
114114
115115
`
116116

117-
exports[`test/lib/commands/ls.js TAP ls --only=development > should output tree containing only development deps 1`] = `
118-
[email protected] {CWD}/tap-testdir-ls-ls---only-development
119-
120-
121-
122-
123-
`
124-
125-
exports[`test/lib/commands/ls.js TAP ls --only=prod > should output tree containing only prod deps 1`] = `
126-
[email protected] {CWD}/tap-testdir-ls-ls---only-prod
127-
128-
129-
130-
131-
132-
`
133-
134117
exports[`test/lib/commands/ls.js TAP ls --parseable --depth=0 > should output tree containing only top-level dependencies 1`] = `
135118
{CWD}/tap-testdir-ls-ls---parseable---depth-0
136119
{CWD}/tap-testdir-ls-ls---parseable---depth-0/node_modules/chai
@@ -204,21 +187,6 @@ exports[`test/lib/commands/ls.js TAP ls --parseable --long with extraneous deps
204187
{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/dog:[email protected]
205188
`
206189

207-
exports[`test/lib/commands/ls.js TAP ls --parseable --only=development > should output tree containing only development deps 1`] = `
208-
{CWD}/tap-testdir-ls-ls---parseable---only-development
209-
{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/dev-dep
210-
{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/foo
211-
{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/dog
212-
`
213-
214-
exports[`test/lib/commands/ls.js TAP ls --parseable --only=prod > should output tree containing only prod deps 1`] = `
215-
{CWD}/tap-testdir-ls-ls---parseable---only-prod
216-
{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/chai
217-
{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/optional-dep
218-
{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep
219-
{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep/node_modules/dog
220-
`
221-
222190
exports[`test/lib/commands/ls.js TAP ls --parseable --production > should output tree containing production deps 1`] = `
223191
{CWD}/tap-testdir-ls-ls---parseable---production
224192
{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/chai

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Options:
5151
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
5252
[--foreground-scripts] [--ignore-scripts]
5353
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
54-
[-ws|--workspaces] [--include-workspace-root]
54+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
5555
5656
Run "npm help audit" for more info
5757
`
@@ -164,7 +164,7 @@ Options:
164164
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
165165
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
166166
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
167-
[-ws|--workspaces] [--include-workspace-root]
167+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
168168
169169
alias: ddp
170170
@@ -314,7 +314,7 @@ Options:
314314
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
315315
[--no-audit] [--no-bin-links] [--no-fund]
316316
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
317-
[-ws|--workspaces] [--include-workspace-root]
317+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
318318
319319
Run "npm help find-dupes" for more info
320320
`
@@ -423,7 +423,7 @@ Options:
423423
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
424424
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
425425
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
426-
[-ws|--workspaces] [--include-workspace-root]
426+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
427427
428428
aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
429429
@@ -467,7 +467,7 @@ Options:
467467
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
468468
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
469469
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
470-
[-ws|--workspaces] [--include-workspace-root]
470+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
471471
472472
alias: it
473473
@@ -488,7 +488,7 @@ Options:
488488
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
489489
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
490490
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
491-
[-ws|--workspaces] [--include-workspace-root]
491+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
492492
493493
alias: ln
494494
@@ -506,7 +506,7 @@ Options:
506506
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--link]
507507
[--package-lock-only] [--unicode]
508508
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
509-
[-ws|--workspaces] [--include-workspace-root]
509+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
510510
511511
alias: la
512512
@@ -550,7 +550,7 @@ Options:
550550
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--link]
551551
[--package-lock-only] [--unicode]
552552
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
553-
[-ws|--workspaces] [--include-workspace-root]
553+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
554554
555555
alias: list
556556
@@ -683,7 +683,7 @@ Options:
683683
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--dry-run]
684684
[--json] [--foreground-scripts] [--ignore-scripts]
685685
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
686-
[-ws|--workspaces] [--include-workspace-root]
686+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
687687
688688
Run "npm help prune" for more info
689689
`
@@ -711,7 +711,7 @@ npm rebuild [[<@scope>/]<name>[@<version>] ...]
711711
Options:
712712
[-g|--global] [--no-bin-links] [--foreground-scripts] [--ignore-scripts]
713713
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
714-
[-ws|--workspaces] [--include-workspace-root]
714+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
715715
716716
alias: rb
717717
@@ -921,7 +921,7 @@ npm uninstall [<@scope>/]<pkg>...
921921
Options:
922922
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
923923
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
924-
[-ws|--workspaces] [--include-workspace-root]
924+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
925925
926926
aliases: unlink, remove, rm, r, un
927927
@@ -967,7 +967,7 @@ Options:
967967
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
968968
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
969969
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
970-
[-ws|--workspaces] [--include-workspace-root]
970+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
971971
972972
aliases: up, upgrade, udpate
973973

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

+12
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Array [
7676
"init.license",
7777
"init.module",
7878
"init.version",
79+
"install-links",
7980
"json",
8081
"key",
8182
"legacy-bundling",
@@ -973,6 +974,17 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for init.
973974
Alias for \`--init-version\`
974975
`
975976

977+
exports[`test/lib/utils/config/definitions.js TAP > config description for install-links 1`] = `
978+
#### \`install-links\`
979+
980+
* Default: false
981+
* Type: Boolean
982+
983+
When set file: protocol dependencies that exist outside of the project root
984+
will be packed and installed as regular dependencies instead of creating a
985+
symlink. This option has no effect on workspaces.
986+
`
987+
976988
exports[`test/lib/utils/config/definitions.js TAP > config description for json 1`] = `
977989
#### \`json\`
978990

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

+12
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,18 @@ number, if not already set in package.json.
765765
<!-- automatically generated, do not edit manually -->
766766
<!-- see lib/utils/config/definitions.js -->
767767
768+
#### \`install-links\`
769+
770+
* Default: false
771+
* Type: Boolean
772+
773+
When set file: protocol dependencies that exist outside of the project root
774+
will be packed and installed as regular dependencies instead of creating a
775+
symlink. This option has no effect on workspaces.
776+
777+
<!-- automatically generated, do not edit manually -->
778+
<!-- see lib/utils/config/definitions.js -->
779+
768780
#### \`json\`
769781
770782
* Default: false

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ All commands:
206206
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
207207
[--foreground-scripts] [--ignore-scripts]
208208
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
209-
[-ws|--workspaces] [--include-workspace-root]
209+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
210210
211211
Run "npm help audit" for more info
212212
@@ -296,7 +296,7 @@ All commands:
296296
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
297297
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
298298
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
299-
[-ws|--workspaces] [--include-workspace-root]
299+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
300300
301301
alias: ddp
302302
@@ -426,7 +426,7 @@ All commands:
426426
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
427427
[--no-audit] [--no-bin-links] [--no-fund]
428428
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
429-
[-ws|--workspaces] [--include-workspace-root]
429+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
430430
431431
Run "npm help find-dupes" for more info
432432
@@ -511,7 +511,7 @@ All commands:
511511
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
512512
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
513513
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
514-
[-ws|--workspaces] [--include-workspace-root]
514+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
515515
516516
aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
517517
@@ -551,7 +551,7 @@ All commands:
551551
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
552552
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
553553
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
554-
[-ws|--workspaces] [--include-workspace-root]
554+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
555555
556556
alias: it
557557
@@ -570,7 +570,7 @@ All commands:
570570
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
571571
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
572572
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
573-
[-ws|--workspaces] [--include-workspace-root]
573+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
574574
575575
alias: ln
576576
@@ -586,7 +586,7 @@ All commands:
586586
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--link]
587587
[--package-lock-only] [--unicode]
588588
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
589-
[-ws|--workspaces] [--include-workspace-root]
589+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
590590
591591
alias: la
592592
@@ -624,7 +624,7 @@ All commands:
624624
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--link]
625625
[--package-lock-only] [--unicode]
626626
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
627-
[-ws|--workspaces] [--include-workspace-root]
627+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
628628
629629
alias: list
630630
@@ -739,7 +739,7 @@ All commands:
739739
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--dry-run]
740740
[--json] [--foreground-scripts] [--ignore-scripts]
741741
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
742-
[-ws|--workspaces] [--include-workspace-root]
742+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
743743
744744
Run "npm help prune" for more info
745745
@@ -763,7 +763,7 @@ All commands:
763763
Options:
764764
[-g|--global] [--no-bin-links] [--foreground-scripts] [--ignore-scripts]
765765
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
766-
[-ws|--workspaces] [--include-workspace-root]
766+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
767767
768768
alias: rb
769769
@@ -941,7 +941,7 @@ All commands:
941941
Options:
942942
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
943943
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
944-
[-ws|--workspaces] [--include-workspace-root]
944+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
945945
946946
aliases: unlink, remove, rm, r, un
947947
@@ -981,7 +981,7 @@ All commands:
981981
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
982982
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
983983
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
984-
[-ws|--workspaces] [--include-workspace-root]
984+
[-ws|--workspaces] [--include-workspace-root] [--install-links]
985985
986986
aliases: up, upgrade, udpate
987987

0 commit comments

Comments
 (0)