From 57ce4018dcb96db15b09eff80d28360523393cbe Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Fri, 30 Aug 2024 08:06:09 +0200 Subject: [PATCH] Make the build script also pack empty directories into zip file --- esbuild.config.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/esbuild.config.js b/esbuild.config.js index 52795e7..35a8fc4 100644 --- a/esbuild.config.js +++ b/esbuild.config.js @@ -217,17 +217,13 @@ esbuild archive.pipe(output); // Add everything in the "dist" directory except for "svr.js" and "svr.compressed" - const distFilesAndDirectories = fs.existsSync(__dirname + "/dist") - ? fs.readdirSync(__dirname + "/dist") - : []; - distFilesAndDirectories.forEach((entry) => { - if (entry == "svr.js" || entry == "svr.compressed") return; - const stats = fs.statSync(__dirname + "/dist/" + entry); - if (stats.isDirectory()) { - archive.directory(__dirname + "/dist/" + entry, entry); - } else if (stats.isFile()) { - archive.file(__dirname + "/dist/" + entry, { name: entry }); - } + archive.glob("**/*", { + cwd: __dirname + "/dist", + ignore: [ + "svr.js", + "svr.compressed" + ], + dot: true }); // Create a stream for the "svr.compressed" file