-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.sh
executable file
·93 lines (78 loc) · 1.64 KB
/
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
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
#!/bin/bash
# Script de construction des bundles
# FIXME incompatibilité avec un env. Windows
##########
# doCmd()
function doCmd() {
cmd2issue=$1
eval ${cmd2issue}
retour=$?
if [ $retour -ne 0 ] ; then
printTo "Erreur d'execution (code:${retour}) !..."
exit 100
fi
}
##########
# printTo()
function printTo() {
text=$1
d=`date`
echo "[${d}] ${text}"
}
##########
# clean()
function clean() {
printTo "####### CLEAN !"
doCmd "rm -rf dist"
doCmd "rm -rf samples"
doCmd "rm -rf jsdoc"
}
printTo "BEGIN"
function production() {
printTo "####### production !"
doCmd "npm run build:prod"
}
function map() {
printTo "####### sourcemap !"
doCmd "npm run build:dev"
}
function sources() {
printTo "####### sources !"
doCmd "npm run build"
}
clean
doCmd "npm run clean"
doCmd "npm run setup"
while getopts "aps" opts
do
case $opts in
p)
printTo "#################################"
printTo "##### production bundle ! #######"
production
;;
s)
printTo "#################################"
printTo "###### sources bundle ! ######"
sources
;;
d)
printTo "#################################"
printTo "######### map bundle ! ##########"
map
;;
a)
printTo "#################################"
printTo "########## ALL bundle ! #########"
sources
production
map
;;
\?)
printTo "$OPTARG : option invalide : a(all), d(development), s(sources) ou p(production) !"
exit -1
;;
esac
done
printTo "END"
exit 0