-
Notifications
You must be signed in to change notification settings - Fork 9
/
npm_scripts.sh
executable file
·54 lines (52 loc) · 1.13 KB
/
npm_scripts.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
#!/bin/sh
# jslint utility2:true
shMain() {(set -e
# this function will run the main program
local ARG1
printf "# start run cmd 'npm run $*'\n" 1>&2
UTILITY2_BIN=utility2
if [ -f lib.utility2.sh ]
then
UTILITY2_BIN="$PWD/lib.utility2.sh"
fi
ARG1="$1"
# run cmd - custom
case "$1" in
esac
# run cmd - default
case "$ARG1" in
build-ci)
"$UTILITY2_BIN" shReadmeEval build_ci.sh
;;
eval)
shift
"$@"
;;
heroku-postbuild)
if [ ! -f lib.utility2.sh ]
then
npm install kaizhu256/node-utility2#alpha --prefix .
fi
"$UTILITY2_BIN" shDeployHeroku
;;
start)
export PORT=${PORT:-8080}
if [ -f assets.app.js ]
then
node assets.app.js
else
"$UTILITY2_BIN" start test.js
fi
;;
test)
export PORT=$($UTILITY2_BIN shServerPortRandom)
"$UTILITY2_BIN" test test.js
;;
utility2)
"$@"
;;
esac
printf "# end run cmd 'npm run $*'\n" 1>&2
)}
# run cmd
shMain "$npm_lifecycle_event" "$@"