Fix build step logic to show elm-review contract violation errors.

This commit is contained in:
Dillon Kearns 2022-03-24 15:27:46 -07:00
parent a6870989a1
commit 05bd7b0bff

View File

@ -147,7 +147,15 @@ async function run(options) {
await compileCli; await compileCli;
await compileClientDone; await compileClientDone;
} catch (cliError) { } catch (cliError) {
console.error(cliError); const reviewOutput = JSON.parse(await runElmReview());
const isParsingError = reviewOutput.errors.some((reviewError) => {
return reviewError.errors.some((item) => item.rule === "ParsingError");
});
if (isParsingError) {
console.error(cliError);
} else {
console.error(restoreColorSafe(reviewOutput));
}
process.exit(1); process.exit(1);
} }
await portDataSourceCompiled; await portDataSourceCompiled;
@ -164,21 +172,7 @@ async function run(options) {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
buildError = true; buildError = true;
try { process.exitCode = 1;
const reviewOutput = JSON.parse(await runElmReview());
const isParsingError = reviewOutput.errors.some((reviewError) => {
return reviewError.errors.some((item) => item.rule === "ParsingError");
});
if (isParsingError) {
console.error(error);
} else {
console.error(restoreColorSafe(reviewOutput));
}
process.exitCode = 1;
} catch (noElmReviewErrors) {
console.error(error);
} finally {
}
} }
} }