Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jul 30, 2021
1 parent 2b5e447 commit 556a5bf
Show file tree
Hide file tree
Showing 5 changed files with 245 additions and 37 deletions.
39 changes: 39 additions & 0 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,20 @@ you want to move it to be a non-optional production dependency.
This is the default behavior if `--save` is true, and neither `--save-dev`
or `--save-optional` are true.

#### `save-workspace-root`

* Default: true
* Type: Boolean

When installing a workspace project, npm will place a `.npmrc` file in each
workspace folder by default specifying the workspace root, so that a command
from within that folder will behave the same as if it was run from the root
project with a `--workspace` option.

Set `save-workspace-root` to false to disable this behavior.

This value is not exported to the environment for child processes.

#### `scope`

* Default: the scope of the current project, if any, or ""
Expand Down Expand Up @@ -1377,6 +1391,31 @@ brand new workspace within the project.

This value is not exported to the environment for child processes.

#### `workspace-root`

* Default: null
* Type: Path

When operating within a workspace folder as the current working directory,
this config value may be set to tell npm to use the specified folder as the
project root.

If set in a config file at `./.npmrc` (ie, a project-level config file), no
other options may be set in that file, as the workspace root's project
config will supercede it.

When installing a workspace project, npm will place a `.npmrc` file in each
workspace folder by default specifying the workspace root, so that a command
from within that folder will behave the same as if it was run from the root
project with a `--workspace` option.

Note: when set as a relative path within a config file, this option is
resolved relative to the directory holding the config file. This differs
from most path-type configs, which are always resolved relative to the
current working directory.

This value is not exported to the environment for child processes.

#### `workspaces`

* Default: false
Expand Down
139 changes: 112 additions & 27 deletions node_modules/@npmcli/config/lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 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 @@ -119,6 +119,7 @@ Array [
"save-peer",
"save-prefix",
"save-prod",
"save-workspace-root",
"scope",
"script-shell",
"searchexclude",
Expand Down Expand Up @@ -149,6 +150,7 @@ Array [
"which",
"workspace",
"workspaces",
"workspace-root",
"yes",
]
`
Expand Down Expand Up @@ -1449,6 +1451,22 @@ This is the default behavior if \`--save\` is true, and neither \`--save-dev\`
or \`--save-optional\` are true.
`

exports[`test/lib/utils/config/definitions.js TAP > config description for save-workspace-root 1`] = `
#### \`save-workspace-root\`
* Default: true
* Type: Boolean
When installing a workspace project, npm will place a \`.npmrc\` file in each
workspace folder by default specifying the workspace root, so that a command
from within that folder will behave the same as if it was run from the root
project with a \`--workspace\` option.
Set \`save-workspace-root\` to false to disable this behavior.
This value is not exported to the environment for child processes.
`

exports[`test/lib/utils/config/definitions.js TAP > config description for scope 1`] = `
#### \`scope\`
Expand Down Expand Up @@ -1843,6 +1861,33 @@ brand new workspace within the project.
This value is not exported to the environment for child processes.
`

exports[`test/lib/utils/config/definitions.js TAP > config description for workspace-root 1`] = `
#### \`workspace-root\`
* Default: null
* Type: Path
When operating within a workspace folder as the current working directory,
this config value may be set to tell npm to use the specified folder as the
project root.
If set in a config file at \`./.npmrc\` (ie, a project-level config file), no
other options may be set in that file, as the workspace root's project
config will supercede it.
When installing a workspace project, npm will place a \`.npmrc\` file in each
workspace folder by default specifying the workspace root, so that a command
from within that folder will behave the same as if it was run from the root
project with a \`--workspace\` option.
Note: when set as a relative path within a config file, this option is
resolved relative to the directory holding the config file. This differs
from most path-type configs, which are always resolved relative to the
current working directory.
This value is not exported to the environment for child processes.
`

exports[`test/lib/utils/config/definitions.js TAP > config description for workspaces 1`] = `
#### \`workspaces\`
Expand Down
Loading

0 comments on commit 556a5bf

Please sign in to comment.