Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isaacs/workspace root #3596

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
45 changes: 45 additions & 0 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,23 @@ define('save-prod', {
},
})

define('save-workspace-root', {
default: true,
type: Boolean,
envExport: false,
description: `
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.
`,
flatten,
})


define('scope', {
default: '',
defaultDescription: `
Expand Down Expand Up @@ -2139,6 +2156,34 @@ define('workspaces', {
`,
})

define('workspace-root', {
default: null,
type: path,
hint: '<path>',
envExport: false,
description: `
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.
`,
flatten,
})

define('yes', {
default: null,
type: [null, Boolean],
Expand Down
13 changes: 13 additions & 0 deletions node_modules/@npmcli/arborist/lib/arborist/reify.js

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

Loading