-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sh
executable file
·46 lines (36 loc) · 1.03 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -eo pipefail
# outDir
# brew install jq
out_dir=$(jq -r .compilerOptions.outDir tsconfig.json)
# Clean
git clean -fdx $out_dir
rm -rf build
mkdir build
# Build
node_modules/.bin/tsc
# Validate
python3 build.py validate
# Bundle
node_modules/.bin/rollup -f iife -o build/app.js --no-freeze $out_dir/app.js
# Optimize
node_modules/.bin/terser -cm --mangle-props only_annotated -o build/app.opt.js --comments false build/app.js
node_modules/.bin/cleancss -O1 -o build/app.opt.css $out_dir/app.css
cat <<END >build/options.json
{
"collapseWhitespace": true,
"removeAttributeQuotes": true,
"removeComments": true
}
END
node_modules/.bin/html-minifier-terser -c build/options.json -o build/index.html $out_dir/index.html
python3 build.py manifest
# Package
python3 build.py inline
zip -jX9 build/app.zip build/index.html build/app.json
# brew install advancecomp
advzip -z4 build/app.zip
# https://github.com/fhanau/Efficient-Compression-Tool
ect -10009 -zip build/app.zip
echo Final package size:
wc -c build/app.zip