-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·104 lines (80 loc) · 1.87 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# Create variables for paths
SOURCE_DIR=$PWD
APP_DIR="$SOURCE_DIR/app"
MODULE_A_DIR="$SOURCE_DIR/module-a"
MODULE_B_DIR="$SOURCE_DIR/module-b"
MODULE_C_DIR="$SOURCE_DIR/module-c"
# NPM install dependencies for all
echo "Installing NPM dependencies"
# -- App
cd $APP_DIR
npm install --loglevel silent
echo "-- App dependencies installed"
cd $SOURCE_DIR
# -- Module A
cd $MODULE_A_DIR
npm install --loglevel silent
echo "-- Module A dependencies installed"
cd $SOURCE_DIR
# -- Module B
cd $MODULE_B_DIR
npm install --loglevel silent
echo "-- Module B dependencies installed"
cd $SOURCE_DIR
# -- Module C
cd $MODULE_C_DIR
npm install --loglevel silent
echo "-- Module C dependencies installed"
cd $SOURCE_DIR
# Create global npm links for sub-modules
echo "Creating NPM Links"
# -- Module A
cd $MODULE_A_DIR
npm link
echo "-- npm linked Module A"
cd $SOURCE_DIR
# -- Module B
cd $MODULE_B_DIR
npm link
echo "-- npm linked Module B"
cd $SOURCE_DIR
# -- Module C
cd $MODULE_C_DIR
npm link
echo "-- npm linked Module C"
cd $SOURCE_DIR
# Create module dependency links
echo "NPM Linking sub-modules"
# -- Module B --> Module C
cd $MODULE_C_DIR
npm link npm-peer-test-module-b
echo "-- npm linked Module B as a dependency of Module C"
cd $SOURCE_DIR
# -- Module A, Module B, Module C --> App
cd $APP_DIR
npm link npm-peer-test-module-a
echo "-- npm linked Module A as a dependency of App"
npm link npm-peer-test-module-b
echo "-- npm linked Module B as a dependency of App"
npm link npm-peer-test-module-c
echo "-- npm linked Module C as a dependency of App"
cd $SOURCE_DIR
# Build Modules
echo "Building sub-modules"
# -- Module A
cd $MODULE_A_DIR
npm run build
echo "-- Built Module A"
cd $SOURCE_DIR
# -- Module B
cd $MODULE_B_DIR
npm run build
echo "-- Built Module B"
cd $SOURCE_DIR
# -- Module C
cd $MODULE_C_DIR
npm run build
echo "-- Built Module C"
cd $SOURCE_DIR
echo "Done."