-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-test.sh
executable file
·59 lines (51 loc) · 1.27 KB
/
update-test.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
#!/bin/bash
SELF_PATH="$0"
if [ "${SELF_PATH:0:1}" != "." ] && [ "${SELF_PATH:0:1}" != "/" ]; then
SELF_PATH=./"$SELF_PATH"
fi
SELF_PATH=$( cd -P -- "$(dirname -- "$SELF_PATH")" \
&& pwd -P \
) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
# resolve symlinks
while [ -h "$SELF_PATH" ]; do
DIR=$(dirname -- "$SELF_PATH")
SYM=$(readlink -- "$SELF_PATH")
SELF_PATH=$( cd -- "$DIR" \
&& cd -- $(dirname -- "$SYM") \
&& pwd \
)/$(basename -- "$SYM")
done
DIR=$( dirname -- "$SELF_PATH" )
export npm_config_root=$DIR/root
export npm_config_binroot=$DIR/bin
rm -rf $DIR/{root,bin}
mkdir -p $DIR/root
mkdir -p $DIR/bin
npm ls installed 2>/dev/null | grep -v npm | awk '{print $1}' | xargs npm rm &>/dev/null
npm install \
[email protected] &>/dev/null
npm install ./test/packages/blerg &>/dev/null
npm install [email protected] &>/dev/null
echo ""
echo "##"
echo "## starting update"
echo "##"
echo ""
npm update
echo ""
echo "##"
echo "## update done, all should be 'latest'"
echo "##"
echo ""
list=$( npm ls installed remote 2>/dev/null )
echo "$list"
notlatest=$( echo "$list" | grep -v latest )
if [ "$notlatest" != "" ]; then
echo "Failed: not latest"
echo $notlatest
else
echo "ok"
fi