From 611ac7db24ac1a1b6bc51b78b1294cfc5776d191 Mon Sep 17 00:00:00 2001 From: Rizky Date: Tue, 31 Oct 2023 14:14:49 +0700 Subject: [PATCH] fix --- pkgs/core/build.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pkgs/core/build.ts b/pkgs/core/build.ts index c0d509af..2d2648af 100644 --- a/pkgs/core/build.ts +++ b/pkgs/core/build.ts @@ -69,15 +69,20 @@ if (files) { files .filter((file) => statSync(dir.path(`app/static/${file}`)).isFile()) .map(async (file) => { - const br = brotli.compress( - new Uint8Array( - await Bun.file(dir.path(`app/static/${file}`)).arrayBuffer() - ), - { quality: 11 } - ); - if (br) { - console.log(`Compressing ${file}`); - await writeAsync(dir.path(`app/static-br/${file}`), Buffer.from(br)); + if (!(await Bun.file(dir.path(`app/static-br/${file}`)).exists())) { + const br = brotli.compress( + new Uint8Array( + await Bun.file(dir.path(`app/static/${file}`)).arrayBuffer() + ), + { quality: 11 } + ); + if (br) { + console.log(`Compressing ${file}`); + await writeAsync( + dir.path(`app/static-br/${file}`), + Buffer.from(br) + ); + } } }) );