Fix the error reporting on builds and reloading when there's an error.

main
Zed A. Shaw 2 years ago
parent 1df0c38e05
commit 9533f4faf7
  1. 4
      admin/bando/Bandolier.svelte
  2. 12
      commands/build.js

@ -103,13 +103,13 @@
</bando>
{:else if has_errors}
<bando id="errors" transition:fade|local>
<a href="/admin/#/bando/devinfo/errors/">
<a href="/admin/#/errors/">
<Icon name="alert-circle" light={ true } size="64" />
<span>Errors</span>
</a>
<ul>
{#each errors as error, i}
<li>{ error.filename }</li>
<li>{ error.location.file}</li>
{/each}
</ul>
</bando>

@ -76,11 +76,11 @@ const syncContent = (watch_pattern) => ({
});
build.onEnd(async (result) => {
socket.emit("/reloader/notify", {});
if(result.errors.length > 0) {
console.error(`Build ended with ${result.errors.length} errors`);
} else {
socket.emit("/reloader/notify", {});
if(process.platform === "win32") {
try {
exec_i("robocopy static\\ public\\ /e /NFL /NDL /NJH /NJS /nc /ns /np");
@ -101,8 +101,12 @@ const saveMetaFile = (build_meta, error_file) => ({
name: "saveMetaFile",
setup(build) {
build.onEnd(async (result) => {
mkdir_to(build_meta);
await fs.writeFile(build_meta, JSON.stringify(result.metafile, null, 4));
// when there's an error esbuild doesn't include the metafile portion
if(result.metafile) {
mkdir_to(build_meta);
await fs.writeFile(build_meta, JSON.stringify(result.metafile, null, 4));
}
mkdir_to(error_file);
await fs.writeFile(error_file, JSON.stringify(result, null, 4));
});

Loading…
Cancel
Save