OpenAsar/scripts/minify.sh

19 lines
972 B
Bash
Raw Permalink Normal View History

2022-01-13 21:13:48 +00:00
#!/bin/sh
rm -rf miniSrc
mkdir miniSrc
2022-01-13 21:13:48 +00:00
npx esbuild ./src --bundle --platform=node --external:electron --external:original-fs --external:auto-updater --outfile=miniSrc/index.js
npx esbuild ./src/splash/preload.js --bundle --platform=node --external:electron --external:original-fs --external:auto-updater --outfile=miniSrc/preload.js
npx uglifyjs --compress --mangle --toplevel -o miniSrc/index.js -- miniSrc/index.js
npx uglifyjs --compress --mangle --toplevel -o miniSrc/preload.js -- miniSrc/preload.js
npx uglifyjs --compress --mangle --toplevel -o miniSrc/mainWindowInject.js -- src/mainWindowInject.js
2022-01-13 21:13:48 +00:00
npx html-minifier --collapse-whitespace --remove-comments --remove-script-type-attributes --remove-tag-whitespace --minify-css true --minify-js true -o miniSrc/index.html -- src/splash/index.html
# cp src/splash/index.html miniSrc/
2022-01-13 21:13:48 +00:00
cp src/package.json miniSrc/package.json
npx minify-json miniSrc/package.json
2022-01-13 21:13:48 +00:00
npx asar pack miniSrc minified.asar
2022-01-13 22:00:54 +00:00
rm -rf miniSrc