import { BuildWorkerParameters } from './BuildWorkerParameters' ; import { BuildVariables } from './variables-factory/BuildVariables' ; import { fork , ChildProcess } from 'child_process' ; export class BuildWorkerManager { workers : ChildProcess [ ] = [ ] ; run ( param ) { const cp = fork ( require . resolve ( './BuildWorker' ) ) ; cp . send ( param ) ; this . workers . push ( cp ) ; } terminateAll ( ) { for ( const w of this . workers ) { w . kill ( ) ; } } runJsBuildWorker ( variables ) { this . run ( { build : 'js' , variables : variables } ) ; } runTypeCheckBuildWorker ( variables ) { this . run ( { build : 'type-check' , variables : variables } ) ; } runCssBuildWorker ( variables ) { this . run ( { build : 'css' , variables : variables } ) ; } runCopyBuildWorker ( variables ) { this . run ( { build : 'copy' , variables : variables } ) ; } }