mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-02 00:18:19 +03:00
Fail build if elm-optimize-level-2 isn't found, and print error output (for example if Debug.log's are found).
This commit is contained in:
parent
d22d2bebaf
commit
449e32cf9c
@ -152,7 +152,18 @@ function elmOptimizeLevel2(elmEntrypointPath, outputPath, cwd) {
|
||||
cwd: cwd,
|
||||
}
|
||||
);
|
||||
let commandOutput = "";
|
||||
|
||||
subprocess.stderr.on("data", function (data) {
|
||||
commandOutput += data;
|
||||
});
|
||||
|
||||
subprocess.on("exit", async (code) => {
|
||||
if (code !== 0) {
|
||||
process.exitCode = 1;
|
||||
reject(commandOutput);
|
||||
}
|
||||
});
|
||||
subprocess.on("close", async (code) => {
|
||||
if (code == 0 && (await fs.fileExists(fullOutputPath))) {
|
||||
resolve();
|
||||
@ -173,11 +184,7 @@ async function spawnElmMake(options, elmEntrypointPath, outputPath, cwd) {
|
||||
if (options.debug) {
|
||||
await runElmMake(elmEntrypointPath, outputPath, cwd);
|
||||
} else {
|
||||
try {
|
||||
await elmOptimizeLevel2(elmEntrypointPath, outputPath, cwd);
|
||||
} catch (error) {
|
||||
await runElmMake(elmEntrypointPath, outputPath, cwd);
|
||||
}
|
||||
await elmOptimizeLevel2(elmEntrypointPath, outputPath, cwd);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user