-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·85 lines (67 loc) · 1.38 KB
/
setup.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
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
HERE=`pwd`
ROOT=`dirname $HERE`
MODS=(
"binda"
"rara"
"papanache"
"cassi"
"dodi"
"carmel/sdk:@carmel/sdk"
"chunky/carmel:chunky-carmel-plugin"
"chunky/cli:chunky-cli"
)
DEPS=(
"rara:binda"
"dodi:rara"
"dodi:cassi"
"carmel/sdk:dodi"
"chunky/carmel:@carmel/sdk"
"chunky/cli:chunky-carmel-plugin"
)
NPM_CMD=`which npm`
NPM_BIN=`dirname $NPM_CMD`
NPM_ROOT=`dirname $NPM_BIN`
NPM_MODS="$NPM_ROOT/lib/node_modules"
echo "[dev] setting up ... "
for mod in "${MODS[@]}"
do
dir=`echo $mod | cut -d ":" -f 1`
id=`echo $mod | cut -d ":" -f 2`
if [[ ! -d "$ROOT/$dir" ]]; then
continue
fi
if [ -L "$NPM_MODS/${id}" ] ; then
continue
fi
echo
echo "*** Linking $id ***"
cd "$ROOT/$dir"
npm link
if [ -L "$NPM_MODS/${id}" ] ; then
echo "*** [OK] ***"
else
echo "*** [FAIL] ***"
fi
done
for dep in "${DEPS[@]}"
do
dir=`echo $dep | cut -d ":" -f 1`
targ=`echo $dep | cut -d ":" -f 2`
if [[ ! -d "$ROOT/$dir" ]]; then
continue
fi
if [ -L "$ROOT/$dir/node_modules/${targ}" ] ; then
continue
fi
echo
echo "*** Linking $targ into $dir ***"
cd "$ROOT/$dir"
npm link $targ
if [ -L "$ROOT/$dir/node_modules/${targ}" ] ; then
echo "*** [OK] ***"
else
echo "*** [FAIL] ***"
fi
done
echo "[dev] done. "