diff options
author | Gar <gar+gh@danger.computer> | 2021-10-08 04:40:03 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-11-04 00:04:22 +0300 |
commit | 8ffeb71dfb248b4a76744bd06cd4d6100f17c8ae (patch) | |
tree | b44d12a79dff3afe0c92df6f6c0219f6d91ad471 /lib/workspaces | |
parent | 85d59191cf681eabd8827ca58f925c1063776f61 (diff) |
chore: refactor commands
This is the first phase of refactoring the internal structure of the npm
commands to set us up for future changes. This iteration changes the
function signature of `exec` for all the commands to be a async (no more
callbacks), and also groups all the commands into their own
subdirectory.
It also removes the Proxy `npm.commands` object, in favor of an
`npm.cmd` and `npm.exec` function that breaks up the two things that
proxy was doing. Namely, getting to the attributes of a given command
(`npm.cmd` now does this), and actually running the command `npm.exec`
does this.
PR-URL: https://github.com/npm/cli/pull/3959
Credit: @wraithgar
Close: #3959
Reviewed-by: @lukekarrys
Diffstat (limited to 'lib/workspaces')
-rw-r--r-- | lib/workspaces/arborist-cmd.js | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/lib/workspaces/arborist-cmd.js b/lib/workspaces/arborist-cmd.js deleted file mode 100644 index a75b351be..000000000 --- a/lib/workspaces/arborist-cmd.js +++ /dev/null @@ -1,29 +0,0 @@ -// This is the base for all commands whose execWorkspaces just gets -// a list of workspace names and passes it on to new Arborist() to -// be able to run a filtered Arborist.reify() at some point. - -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) - .then(() => { - this.exec(args, cb) - }) - .catch(er => cb(er)) - } -} - -module.exports = ArboristCmd |