-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_packages.sh
executable file
·39 lines (33 loc) · 1.46 KB
/
update_packages.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
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# update meteor core and related packages
# -----------------------------------------------------------------------------
PACKAGE_DIRS="../lib:../liboauth:../libext"
update_meteor () {
METEOR_PACKAGE_DIRS=${PACKAGE_DIRS} meteor update --all-packages
}
update_npm () {
# --------------------------------------------------------------------------
# update all outdated npm packages to the latest
# thanks to: https://stackoverflow.com/a/55406675/3098783
# --------------------------------------------------------------------------
meteor npm install $(meteor npm outdated | cut -d' ' -f 1 | sed '1d' | xargs -I '$' echo '$@latest' | xargs echo)
# --------------------------------------------------------------------------
# clean installed modules because some modules are broken
# after an update (mostly related to modules that needs to be built)
# --------------------------------------------------------------------------
rm -rf ./node_modules
meteor npm install
}
# -----------------------------------------------------------------------------
# parse optargs
# -----------------------------------------------------------------------------
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
-m | --meteor )
update_meteor
;;
-n | --npm | --node )
update_npm
;;
esac; shift; done
if [[ "$1" == '--' ]]; then shift; fi