-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·62 lines (62 loc) · 1.3 KB
/
compile.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
print_help() {
echo "$0 - Compile javascript files."
echo "Usage: $0 [-d] [-s] [-a] [-f] [-m] [-h]"
}
if [ -z "$PYTHON" ]; then
PYTHON=python3
if ! [ -x "$(command -v $PYTHON)" ]; then
PYTHON=python
fi
fi
if ! [ -x "$(command -v $PYTHON)" ]; then
echo "Python3 is not installed." >&2
exit 1
fi
RUN_AS_MODULE=0
DEBUG=0
SOURCE_MAP_INCLUDE_CONTENT=0
ADD_SOURCE_MAP_URL=0
FORCE_BUILD=0
while getopts "dsafmh" opt; do
case $opt in
h) print_help
exit 0;;
d) DEBUG=$((DEBUG+1))
if [ $DEBUG -gt 2 ]; then
echo "Too much -d specified."
exit 1
fi
;;
s) SOURCE_MAP_INCLUDE_CONTENT=1;;
a) ADD_SOURCE_MAP_URL=1;;
f) FORCE_BUILD=1;;
m) RUN_AS_MODULE=1;;
?) exit 1;;
esac
done
PYT="$PYTHON compile.py -W '*'"
if [ $RUN_AS_MODULE -eq 1 ]; then
PYT="$PYTHON -m compile -W '*'"
fi
if [ $DEBUG -gt 0 ]; then
for i in $(seq 1 $DEBUG); do
PYT="$PYT -d"
done
fi
if [ $SOURCE_MAP_INCLUDE_CONTENT -eq 1 ]; then
PYT="$PYT -s"
fi
if [ $ADD_SOURCE_MAP_URL -eq 1 ]; then
PYT="$PYT -a"
fi
if [ $FORCE_BUILD -eq 1 ]; then
PYT="$PYT -f"
fi
$PYT -t qdchapter.js
$PYT -t popup.js
$PYT -t sandbox.js
$PYT -t options.js
$PYT -t manage.js
$PYT -t qdbook.js
$PYT -t forepage.js
$PYT -t background.js