From 54fe38a92ba215045d64aba46a5f33f141b44a83 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 22 Jun 2025 10:34:25 +0200 Subject: [PATCH] Improve create-dist-file.mjs script --- scripts/create-dist-file.mjs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/create-dist-file.mjs b/scripts/create-dist-file.mjs index 96c454d4..4a156a4b 100644 --- a/scripts/create-dist-file.mjs +++ b/scripts/create-dist-file.mjs @@ -1,23 +1,20 @@ -// Do this as the first thing so that any code reading it knows the right env. -process.env.BABEL_ENV = 'production'; -process.env.NODE_ENV = 'production'; - import chalk from 'chalk'; import AdmZip from 'adm-zip'; import fs from 'fs'; function zipDist(version) { - const versionFileName = `./dist/shlink-web-client_${version}_dist.zip`; + const fileBaseName = `shlink-web-client_${version}_dist`; + const versionFileName = `./dist/${fileBaseName}.zip`; console.log(chalk.cyan(`Generating dist file for version ${chalk.bold(version)}...`)); const zip = new AdmZip(); try { if (fs.existsSync(versionFileName)) { - fs.unlink(versionFileName); + fs.unlinkSync(versionFileName); } - zip.addLocalFolder('./build', `shlink-web-client_${version}_dist`); + zip.addLocalFolder('./build', fileBaseName); zip.writeZip(versionFileName); console.log(chalk.green('Dist file properly generated')); } catch (e) {