I've recently been working on a on-demand build server. The build server is a NodeJS/Express REST API, which essentially wraps the Angular CLI and associated build tooling for completing a custom on-demand Angular application.
Everything is working as expected end to end, but I'd like to be able to get more granular with the status reporting, as Angular builds can be quite time consuming when factoring in 2 very large parts of the process
The two longest running parts of the process:
- the
npm install
(generally automatically kicked off via the ng-new schematic from the default @angular/schematics collection) - the actual
ng build
command.
2 is easy to address, as I am spawning that process (ng build --prod
) via child_process.spawn()
directly.
1 has proven a bit more complicated, as the long running npm install
process is actually kicked off internally to the default Angular ng-new schematic/command. So, if my thinking is correct, this is essentially a explicitly spawned child process (my spawned ng new
) which is internally spawning npm install
.
One work around that I've come up with is to pass in the --skip-install
arg to ng new
, which will prevent the internal npm install
process from being kicked off by the Schematic. By doing this, I can then manually kick off npm install
via child_process.spawn()
and directly observe the stdout and stderr streams.
I'm curious if anyone knows of a way to spy on the stderr and stdout streams from the 'npm install' that's kicked off inside of my explicitly spawned ng new
command?
Thanks!