Skip to content

Commit

Permalink
fix(libnpmexec): workspaces support
Browse files Browse the repository at this point in the history
Fixes the proper path location to use when targetting specific
workspaces.

Makes it so that libnpmexec is always reading from the
Arborist actual tree instead of reading `node_modules` from
the file system when retrieving local package data.

Fixes: npm#3520
Relates to: npm#4619
Relates to: npm/statusboard#403
  • Loading branch information
ruyadorno committed Mar 31, 2022
1 parent ff1367f commit dd6530e
Show file tree
Hide file tree
Showing 6 changed files with 371 additions and 116 deletions.
8 changes: 3 additions & 5 deletions lib/commands/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ class Exec extends BaseCommand {
static ignoreImplicitWorkspace = false
static isShellout = true

async exec (_args, { locationMsg, path, runPath } = {}) {
if (!path) {
path = this.npm.localPrefix
}
async exec (_args, { locationMsg, runPath } = {}) {
const path = this.npm.localPrefix

if (!runPath) {
runPath = process.cwd()
Expand Down Expand Up @@ -95,7 +93,7 @@ class Exec extends BaseCommand {

for (const path of this.workspacePaths) {
const locationMsg = await getLocationMsg({ color, path })
await this.exec(args, { locationMsg, path, runPath: path })
await this.exec(args, { locationMsg, runPath: path })
}
}
}
Expand Down
Loading

0 comments on commit dd6530e

Please sign in to comment.