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. 8
      commands/build.js

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

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

Loading…
Cancel
Save