-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
executable file
·61 lines (48 loc) · 1.42 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
#!/bin/bash
#
# suns.js build command.
#
pushd `dirname $0` >/dev/null 2>&1
[ $? -eq 1 ] && exit 1
__script_dir=`pwd`
popd >/dev/null 2>&1
__uglify="${__script_dir}/node_modules/uglify-js/bin/uglifyjs"
__hint="${__script_dir}/node_modules/jshint/bin/jshint"
__jsdoc="${__script_dir}/node_modules/jsdoc/jsdoc"
__src="${__script_dir}/suns.js"
__min="${__script_dir}/suns.min.js"
[ ! -f ${__uglify} ] && echo "error: uglify command not found. please $ npm install ." && exit 1
[ ! -f ${__hint} ] && echo "error: jshint command not found. please $ npm install ." && exit 1
#
# set version
#
./setver
#
# jshint
#
echo
echo "info: jshint start."
${__hint} ${__src}
# TODO: skip
#[ $? -ne 0 ] && echo "jshint running error." && exit 1
#
# jsdoc3
#
echo
echo "info: jsdoc start."
${__jsdoc} -c ${__script_dir}/.jsdoc3.json -d ${__script_dir}/docs -p -r -l ${__src}
# TODO: skip
#[ $? -ne 0 ] && echo "jsdoc2 running error." && exit 1
VERSION=`cat ${__script_dir}/package.json | grep version | cut -c 17-21`
echo
echo "info: uglify start."
echo "/**" > ${__min}
echo " * @name suns.min.js" >> ${__min}
echo " * @version ${VERSION}" >> ${__min}
echo " * copyright (c) Cyberagent Inc." >> ${__min}
echo " * @overview Async chain utility for browser and node.js" >> ${__min}
echo " */" >> ${__min}
${__uglify} ${__src} -m -c unused=false >> ${__min}
[ $? -ne 0 ] && echo "error: uglify running error." && exit 1
echo "info: output -> ${__min}"
exit 0