import { AsyncPriorityQueue } from "async" ; import { NPMTask } from "./npmTask" ; import { Task , TaskExec } from "./task" ; import { BuildResult , BuildPackage } from "../buildGraph" ; export class ConcurrentNPMTask extends NPMTask { constructor ( node , command , tasks ) { super ( node , command , tasks ) ; } ; protected async runTask ( q ) { this . logVerboseTask ( `Begin Concurrent Child Tasks` ) ; const taskP = new Array < Promise < BuildResult > > ( ) ; for ( const task of this . subTasks ) { taskP . push ( task . run ( q ) ) ; } const results = await Promise . all ( taskP ) ; let retResult = BuildResult . UpToDate ; for ( const result of results ) { if ( result === BuildResult . Failed ) { return BuildResult . Failed ; } if ( result === BuildResult . Success ) { retResult = BuildResult . Success ; } } this . logVerboseTask ( `End Concurrent Child Tasks` ) ; return retResult ; } }