Skip to content

Commit

Permalink
web: fix missing status code on failed build (#11903)
Browse files Browse the repository at this point in the history
* fix missing status code on failed build

Signed-off-by: Jens Langhammer <[email protected]>

* fix locale

Signed-off-by: Jens Langhammer <[email protected]>

* fix format

Signed-off-by: Jens Langhammer <[email protected]>

---------

Signed-off-by: Jens Langhammer <[email protected]>
# Conflicts:
#	web/xliff/tr.xlf
  • Loading branch information
BeryJu committed Nov 4, 2024
1 parent 40cbb75 commit 364a9a1
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions web/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,22 @@ async function buildOneSource(source, dest) {
Date.now() - start
}ms`,
);
return 0;
} catch (exc) {
console.error(`[${new Date(Date.now()).toISOString()}] Failed to build ${source}: ${exc}`);
return 1;
}
}

async function buildAuthentik(interfaces) {
await Promise.allSettled(interfaces.map(([source, dest]) => buildOneSource(source, dest)));
const code = await Promise.allSettled(
interfaces.map(([source, dest]) => buildOneSource(source, dest)),
);
const finalCode = code.reduce((a, res) => a + res.value, 0);
if (finalCode > 0) {
return 1;
}
return 0;
}

let timeoutId = null;
Expand Down Expand Up @@ -163,11 +172,12 @@ if (process.argv.length > 2 && (process.argv[2] === "-w" || process.argv[2] ===
});
} else if (process.argv.length > 2 && (process.argv[2] === "-p" || process.argv[2] === "--proxy")) {
// There's no watch-for-proxy, sorry.
await buildAuthentik(
interfaces.filter(([_, dest]) => ["standalone/loading", "."].includes(dest)),
process.exit(
await buildAuthentik(
interfaces.filter(([_, dest]) => ["standalone/loading", "."].includes(dest)),
),
);
process.exit(0);
} else {
// And the fallback: just build it.
await buildAuthentik(interfaces);
process.exit(await buildAuthentik(interfaces));
}

0 comments on commit 364a9a1

Please sign in to comment.