forked from Charcoal-SE/userscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·45 lines (40 loc) · 866 Bytes
/
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
#!/bin/bash
# Charcoal-SE/userscripts build script. Scripts should each have their own directory; if they wish to customise any
# repo-wide settings, they should also have their own package.json in the directory.
overridden=""
RED="\033[0;31m"
NORMAL="\033[0m"
for dir in */ ;
do
if [ -f $dir"package.json" ]
then
echo "Overridden package.json: $dir"
echo "Ignoring: $dir"
mv $dir "/tmp/$dir"
overridden=$overridden";;$dir"
fi
done
echo "Building main project..."
npm test
ecode=$?
if [ "$ecode" != "0" ]
then
echo -e "${RED}Exit code${NORMAL}: $ecode"
exit $ecode
fi
dirs=(${overridden//;;/ })
for dir in ${dirs[@]} ;
do
echo "Building overridden: $dir"
mv "/tmp/$dir" .
cd $dir
npm install
npm test
ecode=$?
if [ "$ecode" != "0" ]
then
echo -e "${RED}Exit code${NORMAL}: $ecode"
exit $ecode
fi
cd ..
done