From d7d5dd6aa66251805afd9009e3978f61ea732f05 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Thu, 30 Sep 2021 13:55:55 -0700 Subject: Revert "feat(workspaces): --include-workspace-root" This reverts commit f17dfa0ced7d8df9bb7baf378bb20d33175c8e8b. --- docs/content/commands/npm-audit.md | 32 +----- docs/content/commands/npm-dedupe.md | 32 +----- docs/content/commands/npm-diff.md | 32 +----- docs/content/commands/npm-dist-tag.md | 32 +----- docs/content/commands/npm-docs.md | 32 +----- docs/content/commands/npm-exec.md | 32 +----- docs/content/commands/npm-explain.md | 4 +- docs/content/commands/npm-find-dupes.md | 32 +----- docs/content/commands/npm-fund.md | 4 +- docs/content/commands/npm-init.md | 18 +--- docs/content/commands/npm-install-test.md | 32 +----- docs/content/commands/npm-install.md | 32 +----- docs/content/commands/npm-link.md | 32 +----- docs/content/commands/npm-ls.md | 32 +----- docs/content/commands/npm-outdated.md | 4 +- docs/content/commands/npm-pack.md | 32 +----- docs/content/commands/npm-pkg.md | 18 +--- docs/content/commands/npm-prune.md | 32 +----- docs/content/commands/npm-publish.md | 32 +----- docs/content/commands/npm-rebuild.md | 32 +----- docs/content/commands/npm-repo.md | 32 +----- docs/content/commands/npm-run-script.md | 32 +----- docs/content/commands/npm-set-script.md | 32 +----- docs/content/commands/npm-uninstall.md | 32 +----- docs/content/commands/npm-unpublish.md | 18 +--- docs/content/commands/npm-update.md | 32 +----- docs/content/commands/npm-version.md | 32 +----- docs/content/commands/npm-view.md | 32 +----- docs/content/using-npm/config.md | 32 +----- lib/base-command.js | 10 +- lib/diff.js | 1 - lib/dist-tag.js | 2 +- lib/docs.js | 8 +- lib/exec.js | 8 +- lib/explain.js | 9 +- lib/fund.js | 1 - lib/init.js | 4 - lib/link.js | 1 - lib/ls.js | 9 +- lib/npm.js | 12 --- lib/outdated.js | 9 +- lib/pack.js | 1 - lib/publish.js | 10 +- lib/repo.js | 10 +- lib/run-script.js | 1 - lib/set-script.js | 2 +- lib/utils/completion/installed-deep.js | 9 +- lib/utils/config/definitions.js | 41 +------ lib/version.js | 1 - lib/view.js | 1 - lib/workspaces/arborist-cmd.js | 7 +- lib/workspaces/get-workspaces.js | 9 +- package-lock.json | 1 - package.json | 1 - tap-snapshots/test/lib/config.js.test.cjs | 6 +- tap-snapshots/test/lib/dist-tag.js.test.cjs | 12 +-- tap-snapshots/test/lib/init.js.test.cjs | 4 - .../test/lib/load-all-commands.js.test.cjs | 46 ++++---- tap-snapshots/test/lib/ls.js.test.cjs | 6 -- tap-snapshots/test/lib/outdated.js.test.cjs | 8 -- tap-snapshots/test/lib/publish.js.test.cjs | 2 +- .../test/lib/utils/config/definitions.js.test.cjs | 32 +----- .../test/lib/utils/config/describe-all.js.test.cjs | 32 +----- tap-snapshots/test/lib/utils/npm-usage.js.test.cjs | 46 ++++---- test/lib/explain.js | 79 +------------- test/lib/init.js | 23 ---- test/lib/ls.js | 20 ---- test/lib/npm.js | 38 ------- test/lib/outdated.js | 29 ----- test/lib/publish.js | 1 - test/lib/repo.js | 118 ++++++++++----------- test/lib/utils/completion/installed-deep.js | 1 - test/lib/utils/config/definitions.js | 17 --- test/lib/workspaces/get-workspaces.js | 11 -- 74 files changed, 282 insertions(+), 1219 deletions(-) diff --git a/docs/content/commands/npm-audit.md b/docs/content/commands/npm-audit.md index 58c614d79..9fa8c0fcc 100644 --- a/docs/content/commands/npm-audit.md +++ b/docs/content/commands/npm-audit.md @@ -313,8 +313,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -327,35 +327,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-dedupe.md b/docs/content/commands/npm-dedupe.md index 377e17d81..dcb2a98fe 100644 --- a/docs/content/commands/npm-dedupe.md +++ b/docs/content/commands/npm-dedupe.md @@ -247,8 +247,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -261,35 +261,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-diff.md b/docs/content/commands/npm-diff.md index 8d05df779..cf0bbec15 100644 --- a/docs/content/commands/npm-diff.md +++ b/docs/content/commands/npm-diff.md @@ -286,8 +286,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -300,35 +300,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-dist-tag.md b/docs/content/commands/npm-dist-tag.md index a4e0243aa..4ad68ff56 100644 --- a/docs/content/commands/npm-dist-tag.md +++ b/docs/content/commands/npm-dist-tag.md @@ -106,8 +106,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -120,35 +120,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-docs.md b/docs/content/commands/npm-docs.md index 970d17aa8..9f1387dae 100644 --- a/docs/content/commands/npm-docs.md +++ b/docs/content/commands/npm-docs.md @@ -63,8 +63,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -77,35 +77,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-exec.md b/docs/content/commands/npm-exec.md index db2353662..82908d65e 100644 --- a/docs/content/commands/npm-exec.md +++ b/docs/content/commands/npm-exec.md @@ -164,8 +164,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -178,35 +178,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-explain.md b/docs/content/commands/npm-explain.md index 5f05cac0f..4a8af2f70 100644 --- a/docs/content/commands/npm-explain.md +++ b/docs/content/commands/npm-explain.md @@ -85,8 +85,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a diff --git a/docs/content/commands/npm-find-dupes.md b/docs/content/commands/npm-find-dupes.md index f7dc84f9c..e9dbac6d1 100644 --- a/docs/content/commands/npm-find-dupes.md +++ b/docs/content/commands/npm-find-dupes.md @@ -174,8 +174,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -188,35 +188,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-fund.md b/docs/content/commands/npm-fund.md index 606b0a188..83c0b13d8 100644 --- a/docs/content/commands/npm-fund.md +++ b/docs/content/commands/npm-fund.md @@ -122,8 +122,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a diff --git a/docs/content/commands/npm-init.md b/docs/content/commands/npm-init.md index d5a02494f..7355c7588 100644 --- a/docs/content/commands/npm-init.md +++ b/docs/content/commands/npm-init.md @@ -200,8 +200,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -214,20 +214,12 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean +* Default: false +* Type: Boolean -Set to true to run the command in the context of **all** configured +Enable running a command in the context of **all** the configured workspaces. -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-install-test.md b/docs/content/commands/npm-install-test.md index c464e5bd0..c2f9ab3d2 100644 --- a/docs/content/commands/npm-install-test.md +++ b/docs/content/commands/npm-install-test.md @@ -241,8 +241,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -255,35 +255,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-install.md b/docs/content/commands/npm-install.md index a103845d1..de7378718 100644 --- a/docs/content/commands/npm-install.md +++ b/docs/content/commands/npm-install.md @@ -625,8 +625,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -639,35 +639,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-link.md b/docs/content/commands/npm-link.md index d4ef41ae9..5811a8b23 100644 --- a/docs/content/commands/npm-link.md +++ b/docs/content/commands/npm-link.md @@ -325,8 +325,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -339,35 +339,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-ls.md b/docs/content/commands/npm-ls.md index 3b33f0a36..528140bee 100644 --- a/docs/content/commands/npm-ls.md +++ b/docs/content/commands/npm-ls.md @@ -227,8 +227,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -241,35 +241,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-outdated.md b/docs/content/commands/npm-outdated.md index 1b58a6afd..8eb5528c3 100644 --- a/docs/content/commands/npm-outdated.md +++ b/docs/content/commands/npm-outdated.md @@ -167,8 +167,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a diff --git a/docs/content/commands/npm-pack.md b/docs/content/commands/npm-pack.md index 539459868..dda30512d 100644 --- a/docs/content/commands/npm-pack.md +++ b/docs/content/commands/npm-pack.md @@ -69,8 +69,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -83,35 +83,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-pkg.md b/docs/content/commands/npm-pkg.md index beee9c1c4..bf6a2df5d 100644 --- a/docs/content/commands/npm-pkg.md +++ b/docs/content/commands/npm-pkg.md @@ -223,8 +223,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -237,20 +237,12 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean +* Default: false +* Type: Boolean -Set to true to run the command in the context of **all** configured +Enable running a command in the context of **all** the configured workspaces. -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-prune.md b/docs/content/commands/npm-prune.md index 658ab2610..7bd7ad131 100644 --- a/docs/content/commands/npm-prune.md +++ b/docs/content/commands/npm-prune.md @@ -103,8 +103,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -117,35 +117,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-publish.md b/docs/content/commands/npm-publish.md index 6958b1066..946109de4 100644 --- a/docs/content/commands/npm-publish.md +++ b/docs/content/commands/npm-publish.md @@ -188,8 +188,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -202,35 +202,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-rebuild.md b/docs/content/commands/npm-rebuild.md index 75e71c60e..19684796f 100644 --- a/docs/content/commands/npm-rebuild.md +++ b/docs/content/commands/npm-rebuild.md @@ -89,8 +89,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -103,35 +103,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-repo.md b/docs/content/commands/npm-repo.md index cd47fde47..c3c509e0b 100644 --- a/docs/content/commands/npm-repo.md +++ b/docs/content/commands/npm-repo.md @@ -50,8 +50,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -64,35 +64,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-run-script.md b/docs/content/commands/npm-run-script.md index 6dd602d03..e436bc27f 100644 --- a/docs/content/commands/npm-run-script.md +++ b/docs/content/commands/npm-run-script.md @@ -152,8 +152,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -166,35 +166,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-set-script.md b/docs/content/commands/npm-set-script.md index 869ceede0..e39b7a18c 100644 --- a/docs/content/commands/npm-set-script.md +++ b/docs/content/commands/npm-set-script.md @@ -44,8 +44,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -58,35 +58,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-uninstall.md b/docs/content/commands/npm-uninstall.md index 824d0d876..c04e1a7fd 100644 --- a/docs/content/commands/npm-uninstall.md +++ b/docs/content/commands/npm-uninstall.md @@ -85,8 +85,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -99,35 +99,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-unpublish.md b/docs/content/commands/npm-unpublish.md index 13589a03e..1678bb305 100644 --- a/docs/content/commands/npm-unpublish.md +++ b/docs/content/commands/npm-unpublish.md @@ -107,8 +107,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -121,20 +121,12 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean +* Default: false +* Type: Boolean -Set to true to run the command in the context of **all** configured +Enable running a command in the context of **all** the configured workspaces. -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-update.md b/docs/content/commands/npm-update.md index ad02118e4..57b9b91f9 100644 --- a/docs/content/commands/npm-update.md +++ b/docs/content/commands/npm-update.md @@ -341,8 +341,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -355,35 +355,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-version.md b/docs/content/commands/npm-version.md index 91ab0dee0..a02bf5bb9 100644 --- a/docs/content/commands/npm-version.md +++ b/docs/content/commands/npm-version.md @@ -103,8 +103,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -117,35 +117,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/commands/npm-view.md b/docs/content/commands/npm-view.md index 9a1793f13..af354deb8 100644 --- a/docs/content/commands/npm-view.md +++ b/docs/content/commands/npm-view.md @@ -127,8 +127,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -141,35 +141,13 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean - -Set to true to run the command in the context of **all** configured -workspaces. - -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - -This value is not exported to the environment for child processes. - - - - -#### `include-workspace-root` - * Default: false * Type: Boolean -Include the workspace root when workspaces are enabled for a command. +Enable running a command in the context of **all** the configured +workspaces. -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. +This value is not exported to the environment for child processes. diff --git a/docs/content/using-npm/config.md b/docs/content/using-npm/config.md index 647a9e1e0..10e8ca9b9 100644 --- a/docs/content/using-npm/config.md +++ b/docs/content/using-npm/config.md @@ -806,20 +806,6 @@ This is experimental, and not implemented by the npm public registry. -#### `include-workspace-root` - -* Default: false -* Type: Boolean - -Include the workspace root when workspaces are enabled for a command. - -When false, specifying individual workspaces via the `workspace` config, or -all workspaces via the `workspaces` flag, will cause npm to operate only on -the specified workspaces, and not on the root project. - - - - #### `init-author-email` * Default: "" @@ -1758,8 +1744,8 @@ Valid values for the `workspace` config are either: * Workspace names * Path to a workspace directory -* Path to a parent workspace directory (will result in selecting all - workspaces within that folder) +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a @@ -1772,20 +1758,12 @@ This value is not exported to the environment for child processes. #### `workspaces` -* Default: null -* Type: null or Boolean +* Default: false +* Type: Boolean -Set to true to run the command in the context of **all** configured +Enable running a command in the context of **all** the configured workspaces. -Explicitly setting this to false will cause commands like `install` to -ignore workspaces altogether. When not set explicitly: - -- Commands that operate on the `node_modules` tree (install, update, etc.) -will link workspaces into the `node_modules` folder. - Commands that do -other things (test, exec, publish, etc.) will operate on the root project, -_unless_ one or more workspaces are specified in the `workspace` config. - This value is not exported to the environment for child processes. diff --git a/lib/base-command.js b/lib/base-command.js index c5bd3fd94..870c69acc 100644 --- a/lib/base-command.js +++ b/lib/base-command.js @@ -7,6 +7,8 @@ class BaseCommand { constructor (npm) { this.wrapWidth = 80 this.npm = npm + this.workspaces = null + this.workspacePaths = null } get name () { @@ -73,13 +75,7 @@ class BaseCommand { } async setWorkspaces (filters) { - if (this.isArboristCmd) - this.includeWorkspaceRoot = false - - const ws = await getWorkspaces(filters, { - path: this.npm.localPrefix, - includeWorkspaceRoot: this.includeWorkspaceRoot, - }) + const ws = await getWorkspaces(filters, { path: this.npm.localPrefix }) this.workspaces = ws this.workspaceNames = [...ws.keys()] this.workspacePaths = [...ws.values()] diff --git a/lib/diff.js b/lib/diff.js index b1a32705c..01658c466 100644 --- a/lib/diff.js +++ b/lib/diff.js @@ -43,7 +43,6 @@ class Diff extends BaseCommand { 'tag', 'workspace', 'workspaces', - 'include-workspace-root', ] } diff --git a/lib/dist-tag.js b/lib/dist-tag.js index be44f39ff..e32dcf61f 100644 --- a/lib/dist-tag.js +++ b/lib/dist-tag.js @@ -14,7 +14,7 @@ class DistTag extends BaseCommand { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { - return ['workspace', 'workspaces', 'include-workspace-root'] + return ['workspace', 'workspaces'] } /* istanbul ignore next - see test/lib/load-all-commands.js */ diff --git a/lib/docs.js b/lib/docs.js index 51f8be388..69a19c35c 100644 --- a/lib/docs.js +++ b/lib/docs.js @@ -17,13 +17,7 @@ class Docs extends BaseCommand { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { - return [ - 'browser', - 'registry', - 'workspace', - 'workspaces', - 'include-workspace-root', - ] + return ['browser', 'registry', 'workspace', 'workspaces'] } /* istanbul ignore next - see test/lib/load-all-commands.js */ diff --git a/lib/exec.js b/lib/exec.js index d11947483..8c64c2f24 100644 --- a/lib/exec.js +++ b/lib/exec.js @@ -35,13 +35,7 @@ class Exec extends BaseCommand { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { - return [ - 'package', - 'call', - 'workspace', - 'workspaces', - 'include-workspace-root', - ] + return ['package', 'call', 'workspace', 'workspaces'] } /* istanbul ignore next - see test/lib/load-all-commands.js */ diff --git a/lib/explain.js b/lib/explain.js index fc7f57891..7d785d7bf 100644 --- a/lib/explain.js +++ b/lib/explain.js @@ -46,15 +46,8 @@ class Explain extends ArboristWorkspaceCmd { const arb = new Arborist({ path: this.npm.prefix, ...this.npm.flatOptions }) const tree = await arb.loadActual() - if (this.npm.flatOptions.workspacesEnabled - && this.workspaceNames - && this.workspaceNames.length - ) + if (this.workspaceNames && this.workspaceNames.length) this.filterSet = arb.workspaceDependencySet(tree, this.workspaceNames) - else if (!this.npm.flatOptions.workspacesEnabled) { - this.filterSet = - arb.excludeWorkspacesDependencySet(tree) - } const nodes = new Set() for (const arg of args) { diff --git a/lib/fund.js b/lib/fund.js index 97139f5bb..1e0fa1ecb 100644 --- a/lib/fund.js +++ b/lib/fund.js @@ -92,7 +92,6 @@ class Fund extends ArboristWorkspaceCmd { return } - // TODO: add !workspacesEnabled option handling to libnpmfund const fundingInfo = getFundingInfo(tree, { ...this.flatOptions, log: this.npm.log, diff --git a/lib/init.js b/lib/init.js index 30fd7e2f7..e4bd20b72 100644 --- a/lib/init.js +++ b/lib/init.js @@ -54,10 +54,6 @@ class Init extends BaseCommand { } async initWorkspaces (args, filters) { - // if the root package is uninitiated, take care of it first - if (this.npm.flatOptions.includeWorkspaceRoot) - await this.init(args) - // reads package.json for the top-level folder first, by doing this we // ensure the command throw if no package.json is found before trying // to create a workspace package.json file or its folders diff --git a/lib/link.js b/lib/link.js index 2437eb12e..febd90871 100644 --- a/lib/link.js +++ b/lib/link.js @@ -185,7 +185,6 @@ class Link extends ArboristWorkspaceCmd { // atm but should be simple once we have a mocked registry again if (arg.name !== node.name /* istanbul ignore next */ || ( arg.version && - /* istanbul ignore next */ !semver.satisfies(node.version, arg.version) )) { foundNodes.push(node) diff --git a/lib/ls.js b/lib/ls.js index 46cfb2462..495b6348a 100644 --- a/lib/ls.js +++ b/lib/ls.js @@ -82,7 +82,6 @@ class LS extends ArboristWorkspaceCmd { const production = this.npm.config.get('production') const unicode = this.npm.config.get('unicode') const packageLockOnly = this.npm.config.get('package-lock-only') - const workspacesEnabled = this.npm.flatOptions.workspacesEnabled const path = global ? resolve(this.npm.globalDir, '..') : this.npm.prefix @@ -101,18 +100,12 @@ class LS extends ArboristWorkspaceCmd { if (this.workspaceNames && this.workspaceNames.length) wsNodes = arb.workspaceNodes(tree, this.workspaceNames) const filterBySelectedWorkspaces = edge => { - if (!workspacesEnabled - && edge.from.isProjectRoot - && edge.to.isWorkspace - ) - return false - if (!wsNodes || !wsNodes.length) return true if (edge.from.isProjectRoot) { return edge.to && - edge.to.isWorkspace && + edge.to.isWorkspace & wsNodes.includes(edge.to.target) } diff --git a/lib/npm.js b/lib/npm.js index 9b9f3b238..966d11210 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -137,19 +137,7 @@ const npm = module.exports = new class extends EventEmitter { const workspacesEnabled = this.config.get('workspaces') const workspacesFilters = this.config.get('workspace') - if (workspacesEnabled === false && workspacesFilters.length > 0) - return cb(new Error('Can not use --no-workspaces and --workspace at the same time')) - const filterByWorkspaces = workspacesEnabled || workspacesFilters.length > 0 - // normally this would go in the constructor, but our tests don't - // actually use a real npm object so this.npm.config isn't always - // populated. this is the compromise until we can make that a reality - // and then move this into the constructor. - impl.workspaces = this.config.get('workspaces') - impl.workspacePaths = null - // normally this would be evaluated in base-command#setWorkspaces, see - // above for explanation - impl.includeWorkspaceRoot = this.config.get('include-workspace-root') if (this.config.get('usage')) { this.output(impl.usage) diff --git a/lib/outdated.js b/lib/outdated.js index ab46b4536..b3b630421 100644 --- a/lib/outdated.js +++ b/lib/outdated.js @@ -62,14 +62,7 @@ class Outdated extends ArboristWorkspaceCmd { if (this.workspaceNames && this.workspaceNames.length) { this.filterSet = - arb.workspaceDependencySet( - this.tree, - this.workspaceNames, - this.npm.flatOptions.includeWorkspaceRoot - ) - } else if (!this.npm.flatOptions.workspacesEnabled) { - this.filterSet = - arb.excludeWorkspacesDependencySet(this.tree) + arb.workspaceDependencySet(this.tree, this.workspaceNames) } if (args.length !== 0) { diff --git a/lib/pack.js b/lib/pack.js index 848f8afd5..8fc89db1a 100644 --- a/lib/pack.js +++ b/lib/pack.js @@ -30,7 +30,6 @@ class Pack extends BaseCommand { 'pack-destination', 'workspace', 'workspaces', - 'include-workspace-root', ] } diff --git a/lib/publish.js b/lib/publish.js index 32e70129f..9c747eb50 100644 --- a/lib/publish.js +++ b/lib/publish.js @@ -36,15 +36,7 @@ class Publish extends BaseCommand { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { - return [ - 'tag', - 'access', - 'dry-run', - 'otp', - 'workspace', - 'workspaces', - 'include-workspace-root', - ] + return ['tag', 'access', 'dry-run', 'otp', 'workspace', 'workspaces'] } /* istanbul ignore next - see test/lib/load-all-commands.js */ diff --git a/lib/repo.js b/lib/repo.js index bf1d1e7ff..e0172d01f 100644 --- a/lib/repo.js +++ b/lib/repo.js @@ -19,7 +19,7 @@ class Repo extends BaseCommand { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { - return ['browser', 'workspace', 'workspaces', 'include-workspace-root'] + return ['browser', 'workspace', 'workspaces'] } /* istanbul ignore next - see test/lib/load-all-commands.js */ @@ -48,13 +48,7 @@ class Repo extends BaseCommand { } async get (pkg) { - // XXX It is very odd that `where` is how pacote knows to look anywhere - // other than the cwd. - const opts = { - ...this.npm.flatOptions, - where: this.npm.localPrefix, - fullMetadata: true, - } + const opts = { ...this.npm.flatOptions, fullMetadata: true } const mani = await pacote.manifest(pkg, opts) const r = mani.repository diff --git a/lib/run-script.js b/lib/run-script.js index de847ff28..1daaeb990 100644 --- a/lib/run-script.js +++ b/lib/run-script.js @@ -38,7 +38,6 @@ class RunScript extends BaseCommand { return [ 'workspace', 'workspaces', - 'include-workspace-root', 'if-present', 'ignore-scripts', 'script-shell', diff --git a/lib/set-script.js b/lib/set-script.js index 185c4cc90..24e4d8f20 100644 --- a/lib/set-script.js +++ b/lib/set-script.js @@ -12,7 +12,7 @@ class SetScript extends BaseCommand { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { - return ['workspace', 'workspaces', 'include-workspace-root'] + return ['workspace', 'workspaces'] } /* istanbul ignore next - see test/lib/load-all-commands.js */ diff --git a/lib/utils/completion/installed-deep.js b/lib/utils/completion/installed-deep.js index 62686f9b2..590955a1e 100644 --- a/lib/utils/completion/installed-deep.js +++ b/lib/utils/completion/installed-deep.js @@ -7,7 +7,6 @@ const installedDeep = async (npm) => { depth, global, prefix, - workspacesEnabled, } = npm.flatOptions const getValues = (tree) => @@ -20,18 +19,14 @@ const installedDeep = async (npm) => { .sort((a, b) => (a.depth - b.depth) || localeCompare(a.name, b.name)) const res = new Set() - const gArb = new Arborist({ - global: true, - path: resolve(npm.globalDir, '..'), - workspacesEnabled, - }) + const gArb = new Arborist({ global: true, path: resolve(npm.globalDir, '..') }) const gTree = await gArb.loadActual({ global: true }) for (const node of getValues(gTree)) res.add(global ? node.name : [node.name, '-g']) if (!global) { - const arb = new Arborist({ global: false, path: prefix, workspacesEnabled }) + const arb = new Arborist({ global: false, path: prefix }) const tree = await arb.loadActual() for (const node of getValues(tree)) res.add(node.name) diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index 57a50d1c8..009f60a7b 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -918,19 +918,6 @@ define('include-staged', { flatten, }) -define('include-workspace-root', { - default: false, - type: Boolean, - description: ` - Include the workspace root when workspaces are enabled for a command. - - When false, specifying individual workspaces via the \`workspace\` config, - or all workspaces via the \`workspaces\` flag, will cause npm to operate only - on the specified workspaces, and not on the root project. - `, - flatten, -}) - define('init-author-email', { default: '', type: String, @@ -2150,8 +2137,8 @@ define('workspace', { * Workspace names * Path to a workspace directory - * Path to a parent workspace directory (will result in selecting all - workspaces within that folder) + * Path to a parent workspace directory (will result to selecting all of the + nested workspaces) When set for the \`npm init\` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it @@ -2163,34 +2150,16 @@ define('workspace', { }) define('workspaces', { - default: null, - type: [null, Boolean], + default: false, + type: Boolean, short: 'ws', envExport: false, description: ` - Set to true to run the command in the context of **all** configured + Enable running a command in the context of **all** the configured workspaces. - - Explicitly setting this to false will cause commands like \`install\` to - ignore workspaces altogether. - When not set explicitly: - - - Commands that operate on the \`node_modules\` tree (install, update, - etc.) will link workspaces into the \`node_modules\` folder. - - Commands that do other things (test, exec, publish, etc.) will operate - on the root project, _unless_ one or more workspaces are specified in - the \`workspace\` config. `, flatten: (key, obj, flatOptions) => { definitions['user-agent'].flatten('user-agent', obj, flatOptions) - - // TODO: this is a derived value, and should be reworked when we have a - // pattern for derived value - - // workspacesEnabled is true whether workspaces is null or true - // commands contextually work with workspaces or not regardless of - // configuration, so we need an option specifically to disable workspaces - flatOptions.workspacesEnabled = obj[key] !== false }, }) diff --git a/lib/version.js b/lib/version.js index 917a64747..f3680fe8b 100644 --- a/lib/version.js +++ b/lib/version.js @@ -26,7 +26,6 @@ class Version extends BaseCommand { 'sign-git-tag', 'workspace', 'workspaces', - 'include-workspace-root', ] } diff --git a/lib/view.js b/lib/view.js index 46b1b5edf..0124bfb7d 100644 --- a/lib/view.js +++ b/lib/view.js @@ -31,7 +31,6 @@ class View extends BaseCommand { 'json', 'workspace', 'workspaces', - 'include-workspace-root', ] } diff --git a/lib/workspaces/arborist-cmd.js b/lib/workspaces/arborist-cmd.js index a75b351be..cb6b66b8c 100644 --- a/lib/workspaces/arborist-cmd.js +++ b/lib/workspaces/arborist-cmd.js @@ -4,21 +4,16 @@ const BaseCommand = require('../base-command.js') class ArboristCmd extends BaseCommand { - get isArboristCmd () { - return true - } - /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { return [ 'workspace', 'workspaces', - 'include-workspace-root', ] } execWorkspaces (args, filters, cb) { - this.setWorkspaces(filters, true) + this.setWorkspaces(filters) .then(() => { this.exec(args, cb) }) diff --git a/lib/workspaces/get-workspaces.js b/lib/workspaces/get-workspaces.js index 3eb8e4865..91b007455 100644 --- a/lib/workspaces/get-workspaces.js +++ b/lib/workspaces/get-workspaces.js @@ -5,16 +5,11 @@ const rpj = require('read-package-json-fast') // Returns an Map of paths to workspaces indexed by workspace name // { foo => '/path/to/foo' } -const getWorkspaces = async (filters, { path, includeWorkspaceRoot }) => { +const getWorkspaces = async (filters, { path }) => { // TODO we need a better error to be bubbled up here if this rpj call fails const pkg = await rpj(resolve(path, 'package.json')) const workspaces = await mapWorkspaces({ cwd: path, pkg }) - let res = new Map() - if (includeWorkspaceRoot) - res.set(pkg.name, path) - - if (!filters.length) - res = new Map([...res, ...workspaces]) + const res = filters.length ? new Map() : workspaces for (const filterArg of filters) { for (const [workspaceName, workspacePath] of workspaces.entries()) { diff --git a/package-lock.json b/package-lock.json index ec78e50f9..b8decbc1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,6 @@ "name": "npm", "version": "7.24.1", "bundleDependencies": [ - "@isaacs/string-locale-compare", "@npmcli/arborist", "@npmcli/ci-detect", "@npmcli/config", diff --git a/package.json b/package.json index f4cde1d17..31083ff0b 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,6 @@ "write-file-atomic": "^3.0.3" }, "bundleDependencies": [ - "@isaacs/string-locale-compare", "@npmcli/arborist", "@npmcli/ci-detect", "@npmcli/config", diff --git a/tap-snapshots/test/lib/config.js.test.cjs b/tap-snapshots/test/lib/config.js.test.cjs index 805370351..b21b75cd2 100644 --- a/tap-snapshots/test/lib/config.js.test.cjs +++ b/tap-snapshots/test/lib/config.js.test.cjs @@ -68,7 +68,6 @@ exports[`test/lib/config.js TAP config list --json > output matches snapshot 1`] "ignore-scripts": false, "include": [], "include-staged": false, - "include-workspace-root": false, "init-author-email": "", "init-author-name": "", "init-author-url": "", @@ -153,7 +152,7 @@ exports[`test/lib/config.js TAP config list --json > output matches snapshot 1`] "viewer": "{VIEWER}", "which": null, "workspace": [], - "workspaces": null, + "workspaces": false, "yes": null, "metrics-registry": "https://registry.npmjs.org/" } @@ -218,7 +217,6 @@ if-present = false ignore-scripts = false include = [] include-staged = false -include-workspace-root = false init-author-email = "" init-author-name = "" init-author-url = "" @@ -305,7 +303,7 @@ versions = false viewer = "{VIEWER}" which = null workspace = [] -workspaces = null +workspaces = false yes = null ; "global" config from {GLOBALPREFIX}/npmrc diff --git a/tap-snapshots/test/lib/dist-tag.js.test.cjs b/tap-snapshots/test/lib/dist-tag.js.test.cjs index f651f7b67..21d9331db 100644 --- a/tap-snapshots/test/lib/dist-tag.js.test.cjs +++ b/tap-snapshots/test/lib/dist-tag.js.test.cjs @@ -18,7 +18,7 @@ npm dist-tag ls [] Options: [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: dist-tags @@ -40,7 +40,7 @@ npm dist-tag ls [] Options: [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: dist-tags @@ -71,7 +71,7 @@ npm dist-tag ls [] Options: [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: dist-tags @@ -93,7 +93,7 @@ npm dist-tag ls [] Options: [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: dist-tags @@ -121,7 +121,7 @@ npm dist-tag ls [] Options: [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: dist-tags @@ -179,7 +179,7 @@ npm dist-tag ls [] Options: [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: dist-tags diff --git a/tap-snapshots/test/lib/init.js.test.cjs b/tap-snapshots/test/lib/init.js.test.cjs index 37ad8c3a8..95abbe6c1 100644 --- a/tap-snapshots/test/lib/init.js.test.cjs +++ b/tap-snapshots/test/lib/init.js.test.cjs @@ -5,10 +5,6 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/lib/init.js TAP npm init workspces with root > should print helper info 1`] = ` -Array [] -` - exports[`test/lib/init.js TAP workspaces no args > should print helper info 1`] = ` Array [ Array [ diff --git a/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/tap-snapshots/test/lib/load-all-commands.js.test.cjs index d287d1284..9f811a005 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -56,7 +56,7 @@ Options: [--json] [--package-lock-only] [--omit [--omit ...]] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] Run "npm help audit" for more info ` @@ -173,7 +173,7 @@ Options: [--omit [--omit ...]] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: ddp @@ -208,7 +208,7 @@ Options: [--diff-no-prefix] [--diff-src-prefix ] [--diff-dst-prefix ] [--diff-text] [-g|--global] [--tag ] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] Run "npm help diff" for more info ` @@ -225,7 +225,7 @@ npm dist-tag ls [] Options: [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: dist-tags @@ -243,7 +243,7 @@ npm docs [ [ ...]] Options: [--no-browser|--browser ] [--registry ] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: home @@ -293,7 +293,7 @@ Options: [--package [@] [--package [@] ...]] [-c|--call ] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: x @@ -343,7 +343,7 @@ Options: [--omit [--omit ...]] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] Run "npm help find-dupes" for more info ` @@ -452,7 +452,7 @@ Options: [--omit [--omit ...]] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, add @@ -499,7 +499,7 @@ Options: [--omit [--omit ...]] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: it @@ -522,7 +522,7 @@ Options: [--omit [--omit ...]] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: ln @@ -542,7 +542,7 @@ Options: [--omit [--omit ...]] [--link] [--package-lock-only] [--unicode] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: la @@ -592,7 +592,7 @@ Options: [--omit [--omit ...]] [--link] [--package-lock-only] [--unicode] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: list @@ -661,7 +661,7 @@ npm pack [[<@scope>/]...] Options: [--dry-run] [--json] [--pack-destination ] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] Run "npm help pack" for more info ` @@ -740,7 +740,7 @@ npm prune [[<@scope>/]...] Options: [--omit [--omit ...]] [--dry-run] [--json] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] Run "npm help prune" for more info ` @@ -756,7 +756,7 @@ npm publish [] Options: [--tag ] [--access ] [--dry-run] [--otp ] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] Run "npm help publish" for more info ` @@ -772,7 +772,7 @@ npm rebuild [[<@scope>/][@] ...] Options: [-g|--global] [--no-bin-links] [--ignore-scripts] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] alias: rb @@ -790,7 +790,7 @@ npm repo [ [ ...]] Options: [--no-browser|--browser ] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] Run "npm help repo" for more info ` @@ -833,7 +833,7 @@ npm run-script [-- ] Options: [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] [--if-present] [--ignore-scripts] +[-ws|--workspaces] [--if-present] [--ignore-scripts] [--script-shell ] aliases: run, rum, urn @@ -880,7 +880,7 @@ npm set-script [