Skip to content

Commit

Permalink
feat: add install-links config definition
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf authored and lukekarrys committed Apr 19, 2022
1 parent a4adf25 commit bedd8a1
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 56 deletions.
12 changes: 12 additions & 0 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,18 @@ number, if not already set in package.json.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->

#### `install-links`

* Default: false
* Type: Boolean

When set file: protocol dependencies that exist outside of the project root
will be packed and installed as regular dependencies instead of creating a
symlink. This option has no effect on workspaces.

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

#### `json`

* Default: false
Expand Down
1 change: 1 addition & 0 deletions lib/arborist-cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ArboristCmd extends BaseCommand {
'workspace',
'workspaces',
'include-workspace-root',
'install-links',
]

static ignoreImplicitWorkspace = false
Expand Down
11 changes: 11 additions & 0 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,17 @@ define('init.version', {
`,
})

define('install-links', {
default: false,
type: Boolean,
description: `
When set file: protocol dependencies that exist outside of the project root
will be packed and installed as regular dependencies instead of creating a
symlink. This option has no effect on workspaces.
`,
flatten,
})

define('json', {
default: false,
type: Boolean,
Expand Down
2 changes: 2 additions & 0 deletions tap-snapshots/test/lib/commands/config.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"init.license": "ISC",
"init.module": "{HOME}/.npm-init.js",
"init.version": "1.0.0",
"install-links": false,
"key": null,
"legacy-bundling": false,
"legacy-peer-deps": false,
Expand Down Expand Up @@ -234,6 +235,7 @@ init.author.url = ""
init.license = "ISC"
init.module = "{HOME}/.npm-init.js"
init.version = "1.0.0"
install-links = false
json = false
key = null
legacy-bundling = false
Expand Down
32 changes: 0 additions & 32 deletions tap-snapshots/test/lib/commands/ls.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,6 @@ test-npm-ls@1.0.0
`

exports[`test/lib/commands/ls.js TAP ls --only=development > should output tree containing only development deps 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---only-development
\`-- dev-dep@1.0.0
\`-- foo@1.0.0
\`-- dog@1.0.0
`

exports[`test/lib/commands/ls.js TAP ls --only=prod > should output tree containing only prod deps 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---only-prod
+-- chai@1.0.0
+-- optional-dep@1.0.0
\`-- prod-dep@1.0.0
\`-- dog@2.0.0
`

exports[`test/lib/commands/ls.js TAP ls --parseable --depth=0 > should output tree containing only top-level dependencies 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---depth-0
{CWD}/tap-testdir-ls-ls---parseable---depth-0/node_modules/chai
Expand Down Expand Up @@ -204,21 +187,6 @@ exports[`test/lib/commands/ls.js TAP ls --parseable --long with extraneous deps
{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/dog:dog@1.0.0
`

exports[`test/lib/commands/ls.js TAP ls --parseable --only=development > should output tree containing only development deps 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---only-development
{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/dev-dep
{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/foo
{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/dog
`

exports[`test/lib/commands/ls.js TAP ls --parseable --only=prod > should output tree containing only prod deps 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---only-prod
{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/optional-dep
{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep
{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep/node_modules/dog
`

exports[`test/lib/commands/ls.js TAP ls --parseable --production > should output tree containing production deps 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---production
{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/chai
Expand Down
24 changes: 12 additions & 12 deletions tap-snapshots/test/lib/load-all-commands.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Options:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--foreground-scripts] [--ignore-scripts]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
Run "npm help audit" for more info
`
Expand Down Expand Up @@ -164,7 +164,7 @@ Options:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: ddp
Expand Down Expand Up @@ -314,7 +314,7 @@ Options:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
[--no-audit] [--no-bin-links] [--no-fund]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
Run "npm help find-dupes" for more info
`
Expand Down Expand Up @@ -423,7 +423,7 @@ Options:
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
Expand Down Expand Up @@ -467,7 +467,7 @@ Options:
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: it
Expand All @@ -488,7 +488,7 @@ Options:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: ln
Expand All @@ -506,7 +506,7 @@ Options:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--link]
[--package-lock-only] [--unicode]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: la
Expand Down Expand Up @@ -550,7 +550,7 @@ Options:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--link]
[--package-lock-only] [--unicode]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: list
Expand Down Expand Up @@ -683,7 +683,7 @@ Options:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--dry-run]
[--json] [--foreground-scripts] [--ignore-scripts]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
Run "npm help prune" for more info
`
Expand Down Expand Up @@ -711,7 +711,7 @@ npm rebuild [[<@scope>/]<name>[@<version>] ...]
Options:
[-g|--global] [--no-bin-links] [--foreground-scripts] [--ignore-scripts]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: rb
Expand Down Expand Up @@ -921,7 +921,7 @@ npm uninstall [<@scope>/]<pkg>...
Options:
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
aliases: unlink, remove, rm, r, un
Expand Down Expand Up @@ -967,7 +967,7 @@ Options:
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
aliases: up, upgrade, udpate
Expand Down
12 changes: 12 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 @@ -76,6 +76,7 @@ Array [
"init.license",
"init.module",
"init.version",
"install-links",
"json",
"key",
"legacy-bundling",
Expand Down Expand Up @@ -973,6 +974,17 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for init.
Alias for \`--init-version\`
`

exports[`test/lib/utils/config/definitions.js TAP > config description for install-links 1`] = `
#### \`install-links\`
* Default: false
* Type: Boolean
When set file: protocol dependencies that exist outside of the project root
will be packed and installed as regular dependencies instead of creating a
symlink. This option has no effect on workspaces.
`

exports[`test/lib/utils/config/definitions.js TAP > config description for json 1`] = `
#### \`json\`
Expand Down
12 changes: 12 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 @@ -765,6 +765,18 @@ number, if not already set in package.json.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
#### \`install-links\`
* Default: false
* Type: Boolean
When set file: protocol dependencies that exist outside of the project root
will be packed and installed as regular dependencies instead of creating a
symlink. This option has no effect on workspaces.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
#### \`json\`
* Default: false
Expand Down
24 changes: 12 additions & 12 deletions tap-snapshots/test/lib/utils/npm-usage.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ All commands:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--foreground-scripts] [--ignore-scripts]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
Run "npm help audit" for more info
Expand Down Expand Up @@ -296,7 +296,7 @@ All commands:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: ddp
Expand Down Expand Up @@ -426,7 +426,7 @@ All commands:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
[--no-audit] [--no-bin-links] [--no-fund]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
Run "npm help find-dupes" for more info
Expand Down Expand Up @@ -511,7 +511,7 @@ All commands:
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
Expand Down Expand Up @@ -551,7 +551,7 @@ All commands:
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: it
Expand All @@ -570,7 +570,7 @@ All commands:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: ln
Expand All @@ -586,7 +586,7 @@ All commands:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--link]
[--package-lock-only] [--unicode]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: la
Expand Down Expand Up @@ -624,7 +624,7 @@ All commands:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--link]
[--package-lock-only] [--unicode]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: list
Expand Down Expand Up @@ -739,7 +739,7 @@ All commands:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--dry-run]
[--json] [--foreground-scripts] [--ignore-scripts]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
Run "npm help prune" for more info
Expand All @@ -763,7 +763,7 @@ All commands:
Options:
[-g|--global] [--no-bin-links] [--foreground-scripts] [--ignore-scripts]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
alias: rb
Expand Down Expand Up @@ -941,7 +941,7 @@ All commands:
Options:
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
aliases: unlink, remove, rm, r, un
Expand Down Expand Up @@ -981,7 +981,7 @@ All commands:
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
aliases: up, upgrade, udpate
Expand Down

0 comments on commit bedd8a1

Please sign in to comment.