From a5c31af1e3078a3f9976a42a173d6ba5c8c811b5 Mon Sep 17 00:00:00 2001 From: Rizky Date: Tue, 16 Jan 2024 18:30:35 +0700 Subject: [PATCH] wip fix --- pkgs/core/build.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/core/build.ts b/pkgs/core/build.ts index 948124a6..352cca6e 100644 --- a/pkgs/core/build.ts +++ b/pkgs/core/build.ts @@ -47,7 +47,7 @@ if (!(await existsAsync(public_br))) { { quality: 11 } ); if (br) { - console.log(`Compressing ${file}`); + console.log(`Compressing [public] ${file}`); await writeAsync( dir.path(`app/web/public-br/${file}`), Buffer.from(br) @@ -74,7 +74,7 @@ if (files) { { quality: 11 } ); if (br) { - console.log(`Compressing ${file}`); + console.log(`Compressing [static] ${file}`); await writeAsync( dir.path(`app/static-br/${file}`), Buffer.from(br) @@ -87,13 +87,15 @@ if (files) { const pub = await listAsync(dir.path("app/web/public-br")); if (pub) { await Promise.all( - pub.map((file) => - copyAsync( + pub.map(async (file) => { + if (await existsAsync(`app/static-br/${file}`)) { + await removeAsync(`app/static-br/${file}`); + } + await copyAsync( dir.path(`app/web/public-br/${file}`), - dir.path(`app/static-br/${file}`), - { overwrite: true } - ) - ) + dir.path(`app/static-br/${file}`) + ); + }) ); } }