build(docs-infra): exit with an error code if generating StackBlitz examples fails (#41725)

Previously, failing to generate one or more StackBlitz examples would
log the errors but exit the command successfully. This made it easy to
miss such failures.

This commit fixes this by exiting the process with an error code if
generating one or more StackBlitz examples fails.
(In order to be able to see all potential errors, all examples are
attempted to be generated before exiting the process.)

PR Close #41725
This commit is contained in:
George Kalpakas 2021-04-20 17:20:07 +03:00 committed by Jessica Janiuk
parent a4a55f0687
commit 5a80bc6eb5
1 changed files with 6 additions and 1 deletions

View File

@ -25,14 +25,19 @@ class StackblitzBuilder {
// const stackblitzPaths = path.join(this.basePath, '**/testing/*stackblitz.json');
const stackblitzPaths = path.join(this.basePath, '**/*stackblitz.json');
const fileNames = globby.sync(stackblitzPaths, { ignore: ['**/node_modules/**'] });
let failed = false;
fileNames.forEach((configFileName) => {
try {
// console.log('***'+configFileName)
this._buildStackblitzFrom(configFileName);
} catch (e) {
failed = true;
console.log(e);
}
});
if (failed) {
process.exit(1);
}
}
_addDependencies(config, postData) {