-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_version.sh
executable file
·72 lines (64 loc) · 1.38 KB
/
update_version.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
71
72
!/bin/sh
install="N"
build="N"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-i|--install)
install="Y"
shift # past value
;;
-b|--build)
build="Y"
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}"
if [ "$#" -ne 1 ]; then
echo "Usage: $0 -i|--install -b|--build MDDS_VERSION" >&2
exit 1
fi
VERSION=$1
echo "Upgrade to MDDS and MEAN-REST VERSION $VERSION..."
BASEDIR=$PWD
packages=(
"@hicoder\/angular-core"
"@hicoder\/angular-cli"
"@hicoder\/angular-composite"
"@hicoder\/angular-action-base"
"@hicoder\/angular-action-email"
"@hicoder\/angular-auth"
"@hicoder\/angular-file"
"@hicoder\/angular-richtext"
"@hicoder\/angular-shopping-framework"
"@hicoder\/angular-shopping-cart"
"@hicoder\/express-emailing"
"@hicoder\/express-auth-app"
"@hicoder\/express-auth-server"
"@hicoder\/express-file-server"
"@hicoder\/express-core"
)
BASEDIR=$PWD
folders=(".")
number=0
for fd in "${folders[@]}"
do
number=$(($number+1))
echo "=========$number: Processing $fd ..."
cd $BASEDIR/$fd
for element in "${packages[@]}"
do
sed -i '' -e "s/\"$element\":[[:space:]]*\".*\"/\"$element\": \"$VERSION\"/g" package.json
done
if [ $install = "Y" ]; then
rm -rf node_modules
npm install
fi
done