From 8c38bc45c0463ebb770576d07c8d95792a383ecd Mon Sep 17 00:00:00 2001 From: qunash Date: Wed, 25 Jan 2023 20:31:20 +0300 Subject: [PATCH] ~keep zip files on build --- build.mjs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build.mjs b/build.mjs index 74f50b8..39ad41c 100644 --- a/build.mjs +++ b/build.mjs @@ -11,8 +11,12 @@ import path from 'path'; const buildDir = "build"; const minify = process.argv.includes("--minify"); -async function deleteBuildDir() { - await fs.remove(buildDir); +async function cleanBuildDir() { + const entries = await fs.readdir(buildDir); + for (const entry of entries) { + if (path.extname(entry) === ".zip") continue; + await fs.remove(`${buildDir}/${entry}`); + } } async function runEsbuild() { @@ -97,7 +101,7 @@ async function addFilesToZip(archive, browser) { } async function build() { - await deleteBuildDir(); + await cleanBuildDir(); await runEsbuild(); const createZips = process.argv.includes("--create-zips");