-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: Add workspaces functionality to reify commands
Not 100% confident in this approach, but seems like it works, and keeps the duplication within a reasonable level. One big downside is that now we have two base classes.
- Loading branch information
Showing
19 changed files
with
80 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// 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') | ||
const getWorkspaces = require('./workspaces/get-workspaces.js') | ||
class BaseReifyCommand extends BaseCommand { | ||
execWorkspaces (args, filters, cb) { | ||
getWorkspaces(filters, { path: this.npm.localPrefix }) | ||
.then(workspaces => { | ||
this.workspaces = workspaces.map(([name]) => name) | ||
this.exec(args, cb) | ||
}) | ||
} | ||
} | ||
|
||
module.exports = BaseReifyCommand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,3 +191,5 @@ t.test('completion', t => { | |
|
||
t.end() | ||
}) | ||
|
||
t.test('workspaces') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const t = require('tap') | ||
const BaseReifyCommand = require('../../lib/base-reify-command.js') | ||
// Just a dummy thing here so eslint will stop yelling, but it'll still | ||
// log a todo. | ||
t.todo('BaseReifyCommand basic tests', { todo: true }, async t => { | ||
console.log(BaseReifyCommand) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -242,3 +242,5 @@ t.test('should remove existing node_modules before installing', (t) => { | |
throw er | ||
}) | ||
}) | ||
|
||
t.test('workspaces') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,3 +62,5 @@ t.test('should remove dupes using Arborist - no arguments', (t) => { | |
t.end() | ||
}) | ||
}) | ||
|
||
t.test('workspaces') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,3 +218,5 @@ t.test('completion', async t => { | |
t.notOk(res) | ||
t.end() | ||
}) | ||
|
||
t.test('workspaces') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,5 @@ t.test('should prune using Arborist', (t) => { | |
t.end() | ||
}) | ||
}) | ||
|
||
t.test('workspaces') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,3 +256,5 @@ t.test('global prefix', t => { | |
t.end() | ||
}) | ||
}) | ||
|
||
t.test('workspaces') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,3 +249,5 @@ t.test('unknown error reading from localPrefix package.json', t => { | |
t.end() | ||
}) | ||
}) | ||
|
||
t.test('workspaces') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters