compile.sh 1.08 KB
Newer Older
Jacob Durrant's avatar
Jacob Durrant committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# I'm going to compile this outside WebPack. It's an external library. Just
# easier this way.

# Clear dist dir
rm ./dist/*

# Copy over support files.
cp src/*.js ./dist/
cp src/*.mem ./dist/
cp src/*.wasm ./dist/

# Compile typescript
tsc --outFile dist/Webina.js src/Webina.ts

# Closure compile javascript files (NOT advanced).
node ../../node_modules/google-closure-compiler/cli.js --js=dist/Webina.js --js_output_file=dist/Webina.min.js
node ../../node_modules/google-closure-compiler/cli.js --js=dist/vina.js --js_output_file=dist/vina.min.js
node ../../node_modules/google-closure-compiler/cli.js --js=dist/vina.worker.js --js_output_file=dist/vina.worker.min.js

# All min.js files should refer to other min.js files.
ls dist/*.min.js | awk '{print "cat " $1 " | sed \"s/\\.js/.min.js/g\" > t; mv t " $1}' | bash
Jacob Durrant's avatar
Jacob Durrant committed
22
23
24
25

# Fix version
export WEBINA_VERSION=`cat ../Version.ts  | grep VERSION | awk '{print $5}' | sed 's/"//g' | sed "s/;//g"`
grep -l "XXXXXXXXXXXXX.X" dist/* | awk '{print "cat " $1 " | sed \"s/XXXXXXXXXXXXX.X/TMPSTR/g\" > t; mv t " $1}' | sed "s/TMPSTR/${WEBINA_VERSION}/g" | bash