Closed zolakt closed 5 years ago
Reopening this issue, since I pinpointed the problem.
The pre/post hooks work fine, as long as you do a process.exit(1)
from them.
The problem is that the build process returns status 0 (success) for all unhanded errors. Basically, this line https://github.com/steveblue/angular2-rollup/blob/2fc2e81f29833196b0e25cc0cf50847d4506c0aa/index.js#L114
Should be this instead:
if (options.exit) process.exit(1);
If you don't provide the argument to process.exit it defaults to 0, and it's treated as a success code. This makes a big deal in CI. We build a couple of apps sequentially, and if ngr fails, we can't stop the pipeline.,
Also, from the CI perspective, it would be cleaner to do console.error("")
instead of console.log(colors.red, "")
. Also errors should be written with process.stderr.write
instead of process.stdout.write
All valid points that should be addressed. There are plans to migrate angular-rollup to the new Builder API, but these are all valid changes for a hotfix release.
If anyone wants this issue fixed soon please submit a PR.
This is fixed on develop branch.
Fixed in 2.0.4 release
I'm testing this in windows powershell. It seems like the ngr command isn't exiting with a non-successful status code when it breaks,
I'm deliberately throwing exceptions in the pre and post hooks. The exception is printed to console, but the status code is still True. I've tried process.exit(1) instead of exceptions, same result. Tried to reject the promise in the hook, same result.
I'm testing the status using
echo $?
. It's always returning trueThis is a problem in CI builds since we can't break the build and it continues to other stages.