Skip to content

Commit

Permalink
refactor: use map instead of a for loop for runPackageCommand calls
Browse files Browse the repository at this point in the history
  • Loading branch information
apaleslimghost committed Jul 25, 2024
1 parent 63dc37f commit ff2e589
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions plugins/monorepo/src/tasks/workspace-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ export default class WorkspaceCommand extends Task {

const workspaces = await mapWorkspaces({ cwd, pkg })

const packagePromises: Array<Promise<void>> = []

for (const [id, packagePath] of workspaces) {
packagePromises.push(this.runPackageCommand(id, packagePath, command, files))
}
const results = await Promise.allSettled(
Array.from(workspaces, ([id, packagePath]) => this.runPackageCommand(id, packagePath, command, files))
)

const results = await Promise.allSettled(packagePromises)
const erroredCommands = results.filter(
(result): result is PromiseRejectedResult => result.status === 'rejected'
)
Expand Down

0 comments on commit ff2e589

Please sign in to comment.