-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild
executable file
·110 lines (89 loc) · 2.26 KB
/
build
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/sh
SRC=./mod
DIST=./dist
STAGE=$DIST/stage
TARX=$DIST/targetX
TARY=$DIST/targetY
TARZ=$DIST/targetZ
ZIPX=liminalx.zip
ZIPY=liminaly.zip
ZIPZ=liminalz.zip
zipIt() {
TARGET=$1
ZIPPER=$2
echo "Creating the archive from [$TARGET] => [$ZIPPER]"
cd $TARGET
pwd
zip -r $ZIPPER *
mv --verbose $ZIPPER ../
cd -
echo "---------------------------------"
echo "Test unpackaging of [$ZIPPER]..."
cd dist
mkdir $ZIPPER.out
unzip -v $ZIPPER # show what is inside
unzip $ZIPPER -d $ZIPPER.out # unzip it
cd -
}
echo "Indexing source files..."
./index
echo "Cleaning..."
./clean
echo "Screwing..."
./compile-s
echo "Staging the Package..."
mkdir -p $DIST
mkdir -p $STAGE
cp --verbose $SRC/*.css $STAGE/
cp --verbose $SRC/html/*.html $STAGE/
cp --verbose -r $SRC/dry $STAGE/
cp --verbose -r $SRC/jet $STAGE/
cp --verbose -r $SRC/stage $STAGE/
echo "Fixing the Package..."
cd $STAGE/jet
pwd
# fix the debug flag to 0
echo "Changing debug flag to 0..."
sed 's/const debug = 1/const debug = 0/' ./env.js > ./env._js
mv ./env._js ./env.js
# remove line comments from the shader file
echo "Removing comment lines from shaders..."
cat ./shader.js | sed 's://.*::' > ./shader._js
mv ./shader._js ./shader.js
cd -
# initial size estimates
#du -shb $STAGE/*.html
#du -shb $STAGE/js/*.js
# minify
echo "=============="
echo "= Minify ="
echo "=============="
mkdir -p $TARX
node ./tools/minify.js $STAGE $TARX
# just copy html fo now
# TODO minify .html and .css files
cp --verbose $STAGE/*.html $TARX
cp --verbose $STAGE/*.css $TARX
echo "=============="
echo "= GULP ="
echo "=============="
./node_modules/.bin/gulp buildXC
./node_modules/.bin/gulp buildXH
./node_modules/.bin/gulp buildY
./node_modules/.bin/gulp buildG
./node_modules/.bin/gulp buildZ
sleep 5
export SRC=$STAGE
./index
echo "=== Closure Compiler ==="
java -jar ./node_modules/google-closure-compiler-java/compiler.jar --compilation_level ADVANCED --warning_level VERBOSE --js $STAGE/prezap.js > $TARZ/zap.js
echo "============="
echo "= ZIP ="
echo "============="
zipIt $TARX $ZIPX
zipIt $TARY $ZIPY
zipIt $TARZ $ZIPZ
echo '-------------------------------'
du -shb $DIST/*.zip
du -sh --apparent-size $DIST/*.zip
echo '-------------------------------'