-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.sh
69 lines (55 loc) · 1.33 KB
/
script.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
#!/bin/bash
#
#
#
# example :
# sudo bash script.sh -c link
# sudo bash script.sh -c install
while getopts c: option
do
case "${option}"
in
c) COMMAND=${OPTARG};;
esac
done
# ------------------------------------------
# LINK TO LOCAL MODULE DIRECTORIES
if [ $COMMAND = "link" ]
then
echo "LINKING TO LOCAL MODULE DIRECTORIES ... "
npm link enco-poodle-crud-interface
npm link enco-poodle-dav-interface
npm link enco-poodle-utils
fi
# ------------------------------------------
# INSTALL LATEST VERSION FROM NPM AND UPDATE package.json
if [ $COMMAND = "install" ]
then
echo "INSTALLING LATEST VERSION OF NPM PACKAGES AND UPDATE package.json ... "
npm install enco-poodle-crud-interface
npm install enco-poodle-dav-interface
npm install enco-poodle-utils
fi
# ------------------------------------------
# PATCH THE VERSION NUMBER (update by 1) and PUBLISH
if [ $COMMAND = "patch-publish" ]
then
git add .
git commit -a -m "AUTO PATCH"
# update the version (with a patch)
npm version patch
# obtain the new version number
versionvar=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[[:space:]]')
# print
echo "v"$versionvar
# tag the repo push and to github
#git tag "v"$versionvar
git push origin master --tags
# publish to npm
npm publish
fi