forked from PubMatic/OpenWrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-build.sh
73 lines (54 loc) · 1.53 KB
/
init-build.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
#!/bin/bash
# Steps
# run sym links for node_modules folder
# run npm install in current directory i.e. OpenWrap repo
# run npm install in Prebid.js repo ( accept path for the same ? )
# run build.sh with arguments accepted while executing this script
if [ $# -eq 0 ]
then
echo " No arguments supplied"
echo " Provide prebid repo path using -p flag"
echo " Provide build mode using -m flag"
echo " Example: ./init-build.sh -p \"../Prebid.js\" -m \"build\" "
exit 1
fi
while getopts ":p:m:" opt; do
case $opt in
p) prebid_path="$OPTARG"
;;
m) mode="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
if [ -z $prebid_path ]
then
echo "Please provide appropriate Prebid.js repo path "
exit 1
fi
if [ -z $mode ]
then
echo "Please provide appropriate mode argument "
exit 1
fi
OpenWrapNodeModules="${GLOBAL_OPENWRAP_PKG_JSON_DIR_V32}/node_modules/"
function prebidNpmInstall() {
cd $1
PrebidJSNodeModules="${GLOBAL_PREBID_PKG_JSON_DIR_V32}/node_modules/"
symLinkForPrebidNodeModules=node_modules
if [ -L $symLinkForPrebidNodeModules ]; then
unlink $symLinkForPrebidNodeModules
fi
ln -s "$PrebidJSNodeModules" "./node_modules"
npm install
cd ../OpenWrap/
}
symLinkForOpenWrapNodeModules=node_modules
if [ -L $symLinkForOpenWrapNodeModules ]; then
unlink $symLinkForOpenWrapNodeModules
fi
ln -s "$OpenWrapNodeModules" "./node_modules"
npm install
prebidNpmInstall $prebid_path
./build.sh --prebidpath=$prebid_path --mode=$mode