-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmake.sh
executable file
·70 lines (64 loc) · 1.69 KB
/
make.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
#!/bin/bash
# Requires one command:
# - "clean" - delete all node_modules
# - "build" - npm install, test, and build all packages
# - "check" - check what packages need to be published
# - "publish" - npm publish packages with new version numbers
# - "all" - do clean, build, & publish
COMMAND=$1
PROJECTS="cloud client"
if [[ $COMMAND == clean || $COMMAND == all ]]; then
for DIR in $PROJECTS
do
echo
echo "***** Clean Package: $DIR"
echo
pushd $DIR || exit $?
rm -rf node_modules dist
popd
done
fi
if [[ $COMMAND == build || $COMMAND == all ]]; then
# First build all - quit to avoid publishing if anything fails
for DIR in $PROJECTS
do
echo
echo "***** Build Package: $DIR"
echo
pushd $DIR || exit $?
( npm install && npm run test && npm run build) || exit $?
popd
done
if [[ -z "$RTD_BUILD" ]]; then
echo
echo "***** Build documentation: docs"
echo
pushd docs
make html || exit $?
popd
else
echo "(skiping documentation build in ReadTheDocs)"
fi
fi
if [[ $COMMAND == check || $COMMAND == publish || $COMMAND == all ]]; then
for DIR in $PROJECTS
do
pushd $DIR || exit $?
NAME=$(cat package.json |jq .name|tr -d '"')
VER=$(cat package.json |jq .version|tr -d '"')
if [[ -z "$(npm info ${NAME}@${VER} version)" ]]; then
echo
echo "***** Publish: ${NAME}@${VER}"
echo
if [[ $COMMAND != check ]]; then
npm publish || exit $?
fi
else
echo
echo "***** Already Exists: ${NAME}@${VER}"
echo
fi
popd
done
fi
exit 0