forked from spinnaker/deck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildModules.sh
executable file
·46 lines (35 loc) · 1.36 KB
/
buildModules.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
#!/bin/bash -e
# Params to be passed in
MODULES_TO_BE_BUILT=("$@") # optional, if no list of modules are provided, we'll go do all of them except SKIPPED_MODULES
cd "$(dirname "$0")/.."
PROJECT_ROOT=$(pwd)
source ~/.nvm/nvm.sh
NODE_JS_VERSION=`node -e 'console.log(require("./package.json").engines.node.replace(/[^\d\.]/g, ""))'`;
nvm install ${NODE_JS_VERSION}
# go find all the modules and add them
if [[ ${#MODULES_TO_BE_BUILT[0]} -eq 0 ]]; then
SKIPPED_MODULES=("dcos" "canary" "oracle") # skipped modules that are not following the module format
MODULES_TO_BE_BUILT=("core") # enforce module build order
for MODULE_PATH in app/scripts/modules/* ; do
MODULE=$(basename ${MODULE_PATH})
if [[ " ${SKIPPED_MODULES[@]} " =~ " ${MODULE} " ]]; then
echo "Skipping module '${MODULE}' because it's not currently setup for module builds"
continue
fi
if [[ ! -d ${MODULE_PATH} ]]; then
continue
fi
# only add the to the list if if it's not already in there
if [[ ! " ${MODULES_TO_BE_BUILT[@]} " =~ " ${MODULE} " ]]; then
MODULES_TO_BE_BUILT+=("${MODULE}")
fi
done
fi
echo
echo "Modules found: ${MODULES_TO_BE_BUILT[@]}"
# make sure each module is buildable (which lints)
for MODULE in ${MODULES_TO_BE_BUILT[@]}; do
echo "Building module '${MODULE}'..."
cd ${PROJECT_ROOT}/app/scripts/modules/${MODULE}
yarn lib
done