-
Notifications
You must be signed in to change notification settings - Fork 1
/
builder.sh
89 lines (85 loc) · 2.62 KB
/
builder.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
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
#!/bin/bash
lint=1
min=1
doc=1
version="1.1"
function st {
if [ "$1" == "--no-lint" -o "$2" == "--no-lint" -o "$3" == "--no-lint" -o "$4" == "--no-lint" ]; then
lint=0
elif [ "$1" == "--no-min" -o "$2" == "--no-min" -o "$3" == "--no-min" -o "$4" == "--no-min" ]; then
min=0
elif [ "$1" == "--no-doc" -o "$2" == "--no-doc" -o "$3" == "--no-doc" -o "$4" == "--no-doc" ]; then
doc=0
elif [ "$1" == "-l" -o "$2" == "--lint" ]; then
min=0
doc=0
elif [ "$1" == "-m" -o "$2" == "--min" ]; then
lint=0
doc=0
elif [ "$1" == "-d" -o "$2" == "--doc" ]; then
lint=0
min=0
elif [ "$1" == "1.0" -o "$1" == "1.1" -o "$1" == "1.2" ]; then
version="$1"
fi
build
}
function finished {
cd ../
echo "Building of $version complete !!"
}
function build {
if [ "$version" == "1.0" ]; then
cd 1.0
if [ ${lint} -eq 1 ]; then
echo "Linting ..."
eslint essence.js & echo "Linting done!"
fi
if [ ${min} -eq 1 ]; then
echo "Minimisation ..."
minify essence.js --no-comments & echo "Minimisation done!"
fi
if [ ${doc} -eq 1 ]; then
echo "Documentation ..."
jsdoc -d ./docs/1.0/ 1.0/essence.js & echo "Documentation done!"
fi
finished
elif [ "$version" == "1.1" ]; then
cd 1.1
if [ ${lint} -eq 1 ]; then
echo "Linting ..."
eslint essence.js modules & csslint essence.css & echo "Linting done!"
fi
if [ ${min} -eq 1 ]; then
echo "Minimisation ..."
rm modules/*.min.js
minify essence.js --no-comments & minify modules --no-comments & echo ".js scripts minimised"
minify essence.css --no-comments & echo "Minimisation done!"
fi
if [ ${doc} -eq 1 ]; then
echo "Documentation ..."
cd ../
jsdoc -d ./docs/1.1/ 1.1/essence.js 1.1/modules & cd 1.1
fi
finished
else
cd 1.2
if [ ${lint} -eq 1 ]; then
echo "Linting ..."
eslint essence.js & csslint essence.css & echo "Linting done!"
fi
if [ ${min} -eq 1 ]; then
echo "Minimisation ..."
rm modules/*.min.js
minify essence.js modules --no-comments & echo ".js scripts minimised"
minify essence.css --no-comments & echo "Minimisation done!"
fi
if [ ${doc} -eq 1 ]; then
echo "Documentation ..."
jsdoc --package package.json essence.js modules
fi
finished
fi
}
rm -r *.min.min.*
st $1 $2 $3 $4