fix buildscript
All checks were successful
/ test (push) Successful in 13s

This commit is contained in:
yourfriendoss 2024-04-26 21:36:53 +03:00
parent 6784c6fa54
commit 2e1f313ed0

View file

@ -8,14 +8,14 @@ import { WebSocketServer } from 'ws';
const argv = process.argv.slice(2) const argv = process.argv.slice(2)
function buildTs() { async function buildTs() {
console.log("[dev] Building file..") console.log("[dev] Building file..")
esbuild.build({ await esbuild.build({
entryPoints: ["./src/web/ts/index.ts"], entryPoints: ["./src/web/ts/index.ts"],
outfile: "./src/web/dist.js" outfile: "./src/web/dist.js"
}) })
} }
buildTs(); await buildTs();
if(argv[0] == "--build") { if(argv[0] == "--build") {
try{rmdirSync("./dist")}catch{} try{rmdirSync("./dist")}catch{}
@ -93,10 +93,10 @@ if(argv[0] == "--dev") {
console.log('[http] Listening HTTP on 8080.') console.log('[http] Listening HTTP on 8080.')
const watcher = watch("./src/web", { const watcher = watch("./src/web", {
recursive: true, recursive: true,
}, (e,f) => { }, async (e,f) => {
if(f == "dist.js") return; if(f == "dist.js") return;
console.log("[dev] Noticed update in " + f + ", of type " + e +".") console.log("[dev] Noticed update in " + f + ", of type " + e +".")
allConnections.forEach(z => z.send("refresh")); allConnections.forEach(z => z.send("refresh"));
buildTs(); await buildTs();
}) })
} }