This commit is contained in:
Rizky 2024-01-16 18:30:35 +07:00
parent f8dd337412
commit a5c31af1e3
1 changed files with 10 additions and 8 deletions

View File

@ -47,7 +47,7 @@ if (!(await existsAsync(public_br))) {
{ quality: 11 } { quality: 11 }
); );
if (br) { if (br) {
console.log(`Compressing ${file}`); console.log(`Compressing [public] ${file}`);
await writeAsync( await writeAsync(
dir.path(`app/web/public-br/${file}`), dir.path(`app/web/public-br/${file}`),
Buffer.from(br) Buffer.from(br)
@ -74,7 +74,7 @@ if (files) {
{ quality: 11 } { quality: 11 }
); );
if (br) { if (br) {
console.log(`Compressing ${file}`); console.log(`Compressing [static] ${file}`);
await writeAsync( await writeAsync(
dir.path(`app/static-br/${file}`), dir.path(`app/static-br/${file}`),
Buffer.from(br) Buffer.from(br)
@ -87,13 +87,15 @@ if (files) {
const pub = await listAsync(dir.path("app/web/public-br")); const pub = await listAsync(dir.path("app/web/public-br"));
if (pub) { if (pub) {
await Promise.all( await Promise.all(
pub.map((file) => pub.map(async (file) => {
copyAsync( 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/web/public-br/${file}`),
dir.path(`app/static-br/${file}`), dir.path(`app/static-br/${file}`)
{ overwrite: true } );
) })
)
); );
} }
} }