-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildHook.sh
executable file
·47 lines (39 loc) · 990 Bytes
/
buildHook.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
#!/bin/bash
path=$1
#
# Use the optional --continue flag to run Gulp without breaking on warnings/errors
#
# Run: ./buildHook.sh $PWD
#
continueFlag=$2
if [ -z "$path" ] || [ ! -d "$path" ]; then
echo "usage: ./buildHook.sh pathProjectRoot"
echo "for example: ./buildHook.sh \$PWD"
exit
fi
echo "====== Running build hook ======="
echo "=== $gulpfile start ==="
cd $path/$gulpfile
if [ -f package.json ]; then
find . -maxdepth 1 -name package.json | grep package > /dev/null 2>&1
if [ $? == 0 ]; then
echo "= yarn ="
yarn install
if [ $? != 0 ]; then
exit 1
fi
fi
if [ -f node_modules/gulp/bin/gulp.js ]; then
echo "= gulp ="
node_modules/gulp/bin/gulp.js $continueFlag
if [ $? != 0 ]; then
exit 1
fi
else
echo "No gulp installed"
fi
else
echo "Package.json doesn't exist"
fi
echo "=== $gulpfile end ==="
echo "================================="