-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·32 lines (24 loc) · 879 Bytes
/
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
#!/bin/sh
OUT=build/drThorstenRoggendorf.html
WEBCOMPONENTS=node_modules/@webcomponents/custom-elements/src
CSSVARS=node_modules/css-vars-ponyfill/dist/css-vars-ponyfill.esm.js
BUNDLE=build/src/bundle.js
UGLY=build/src/ugly.js
rm -rf build
# babel
./node_modules/.bin/babel src --out-dir build/src
cp -r $WEBCOMPONENTS build/wc
./node_modules/.bin/babel build/wc --out-dir build/$WEBCOMPONENTS
# copy css vars ponyfill and index.html
mkdir build/node_modules/css-vars-ponyfill
mkdir build/node_modules/css-vars-ponyfill/dist
cp $CSSVARS build/$CSSVARS
cp index.html $OUT
# rollup
./node_modules/.bin/rollup -c
# uglify
sed -i -e "s/'use strict';//" $BUNDLE
./node_modules/.bin/uglifyjs --compress --mangle -- $BUNDLE > $UGLY
# insert built results into HTML
sed -i -e 's/<script type="module" src="src\/appl-app.js">/<script>\n/' $OUT
sed -i -e "/<script>/ r $UGLY" $OUT