-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-release.sh
executable file
·35 lines (26 loc) · 1008 Bytes
/
build-release.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
#!/bin/sh
set -euo pipefail
if ! [ -x "$(command -v elm)" ]; then
echo "Please install elm first: npm -g install elm"
exit -1
fi
if ! [ -x "$(command -v elm-test)" ]; then
echo "Please install elm-test first: npm -g install elm-test"
exit -1
fi
if ! [ -x "$(command -v uglifyjs)" ]; then
echo "Please install uglify-js first: npm -g install uglify-js"
exit -1
fi
elm-test
mkdir -p build/js
js="build/js/meeting-price-counter.js"
min="build/js/meeting-price-counter.min.js"
elm make src/Main.elm --optimize --output $js
uglifyjs $js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' | uglifyjs --mangle --output $min
echo "Copying resource/index.html to build folder"
cp resources/index.html build/index.html
echo "Compiled size:$(cat $js | wc -c) bytes ($js)"
echo "Minified size:$(cat $min | wc -c) bytes ($min)"
echo "Gzipped size: $(cat $min | gzip -c | wc -c) bytes"
echo "Files available at build folder."