From 675afd9e55a9975f1cc8cc3d7b521e14fb629c98 Mon Sep 17 00:00:00 2001 From: Oj Date: Fri, 14 Jan 2022 13:45:05 +0000 Subject: [PATCH] [Scripts > Strip] Support bare .js files so don't error on non-dirs --- scripts/strip.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/strip.js b/scripts/strip.js index ec6e18a..bb92ba2 100644 --- a/scripts/strip.js +++ b/scripts/strip.js @@ -8,7 +8,13 @@ execSync(`rm -rf src/package-lock.json src/node_modules/.package-lock.json src/n // Minify node deps code for (const package of readdirSync('src/node_modules')) { - const indexPath = join('src/node_modules', package, 'index.js'); + let indexPath; + if (package.endsWith('.js')) { + indexPath = join('src/node_modules', package); + } else { + indexPath = join('src/node_modules', package, 'index.js'); + } + console.log(package, indexPath); execSync(`npx uglifyjs --compress --mangle -o ${indexPath} -- ${indexPath}`); } \ No newline at end of file