diff options
author | Gar <gar+gh@danger.computer> | 2021-07-28 01:38:07 +0300 |
---|---|---|
committer | nlf <quitlahok@gmail.com> | 2021-10-15 00:41:20 +0300 |
commit | 24273a862e54abfd022df9fc4b8c250bfe77817c (patch) | |
tree | d23b525c0d2dfc5d7235d679802f5f595910dbc6 /lib/base-command.js | |
parent | 0f69d295bd5516f496af75ef29e7ae6304fa2ba5 (diff) |
feat(workspaces): add --include-workspace-root and explicit --no-workspacesfritzy/workspace-root
Adds a new config item that includes the workspace root. This also changes
--workspaces to a trinary, so that setting it to false will explicitly exclude
workspaces altogether.
PR-URL: https://github.com/npm/cli/pull/3890
Credit: @fritzy
Close: #3890
Reviewed-by: @wraithgar
Diffstat (limited to 'lib/base-command.js')
-rw-r--r-- | lib/base-command.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/base-command.js b/lib/base-command.js index 870c69acc..c5bd3fd94 100644 --- a/lib/base-command.js +++ b/lib/base-command.js @@ -7,8 +7,6 @@ class BaseCommand { constructor (npm) { this.wrapWidth = 80 this.npm = npm - this.workspaces = null - this.workspacePaths = null } get name () { @@ -75,7 +73,13 @@ class BaseCommand { } async setWorkspaces (filters) { - const ws = await getWorkspaces(filters, { path: this.npm.localPrefix }) + if (this.isArboristCmd) + this.includeWorkspaceRoot = false + + const ws = await getWorkspaces(filters, { + path: this.npm.localPrefix, + includeWorkspaceRoot: this.includeWorkspaceRoot, + }) this.workspaces = ws this.workspaceNames = [...ws.keys()] this.workspacePaths = [...ws.values()] |