Actually build on run instead of waiting for mutation

This commit is contained in:
2026-02-24 20:44:42 -03:00
parent 86d527ae51
commit 8867e36489
+10 -3
View File
@@ -20,9 +20,18 @@ async function build_client() {
});
}
async function build() {
const now = performance.now();
clear_folder();
build_assets();
await build_client();
console.log(`Built in ${(performance.now() - now).toFixed(2)}ms`);
}
let last_build = 0;
if (import.meta.main) {
await build();
const watcher = Deno.watchFs(["assets", "client", "common"], { recursive: true });
for await (const event of watcher) {
const now = performance.now();
@@ -32,9 +41,7 @@ if (import.meta.main) {
if (["create", "modify", "rename", "remove"].includes(event.kind)) {
last_build = now;
console.log("Rebuilding...");
clear_folder();
build_assets();
await build_client();
await build();
}
}
}