/
npm_patch.sh
55 lines (55 loc) · 1.28 KB
/
npm_patch.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
#!/bin/sh
echo "------------------------"
echo " Script: $0"
echo "------------------------"
Astring="Added feature to package "
BString="Bugfix of package"
Rstring="README.md and documentation updated "
msg="$Bstring"
patchtype="$msg"
if [ $# -eq 0 ]
then
echo "WARNING ($0): No arguments supplied - set commit message"
echo "(A) add new feature"
echo "(B) bugfix of package"
echo "(R) README and documentation updated"
read -e -p "Please Select Patch Type:" PATCHTYPE
echo "Patch Type: ($PATCHTYPE)"
#### Added features
if [ $PATCHTYPE == "A" ]
then
patchtype="$Astring"
fi
if [ $PATCHTYPE == "a" ]
then
patchtype="$Astring"
fi
#### Bugfix of Package
if [ $PATCHTYPE == "B" ]
then
patchtype="$msg"
fi
if [ $PATCHTYPE == "b" ]
then
patchtype="$msg"
fi
#### Bugfix of Package
if [ $PATCHTYPE == "R" ]
then
patchtype="$Rstring"
fi
if [ $PATCHTYPE == "r" ]
then
patchtype="$Rstring"
fi
read -e -p "Please edit Commit Message:" MESSAGE
msg="$patchtype - $MESSAGE"
else
#### Use commit message provided by parameter
msg="$1"
fi
echo "Commit Message: '$msg'"
git add *;
git commit -m "$msg"
git push
npm version patch