-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.sh
executable file
·56 lines (48 loc) · 1.49 KB
/
api.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
#!/bin/bash
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ]
then
echo "usage: npm run api origin smartdevicelink develop"
exit 1
fi
LOCAL_REMOTE_NAME=$1
GH_REMOTE_NAME=$2
BRANCH=$3
if [ ! -d "sdl_javascript_suite" ]
then
git clone --recurse-submodules -b develop https://github.com/smartdevicelink/sdl_javascript_suite.git
elif [ ! -d "sdl_javascript_suite/lib/rpc_spec" ]
then
cd sdl_javascript_suite
git submodule init
git submodule update
cd ..
fi
cd sdl_javascript_suite/lib/rpc_spec
git fetch
git checkout --track $LOCAL_REMOTE_NAME/$BRANCH
git checkout $BRANCH
python3 -m pip install -r InterfaceParser/requirements.txt
git pull
cd ../..
npm install
npm run build
if [ -f "lib/js/dist/SDL.min.js" ]
then
cp lib/js/dist/SDL.min.js ../src/public/.
elif [ -f "dist/js/SDL.min.js" ]
then
cp dist/js/SDL.min.js ../src/public/.
else
echo "ERROR: could not find compiled SDL.min.js!"
exit 2
fi
if [[ "$OSTYPE" == "darwin"* ]]
then
sed -i "" -e "1s;^;/* eslint-disable */ ;" ../src/public/SDL.min.js
sed -i "" -e "s:var remote = \'.*\';:var remote = \'$GH_REMOTE_NAME\';:" ../src/components/MenuBar.jsx
sed -i "" -e "s:var branch = \'.*\';:var branch = \'$BRANCH\';:" ../src/components/MenuBar.jsx
else
sed -i -e "1s;^;/* eslint-disable */ ;" ../src/public/SDL.min.js
sed -i -e "s:var remote = \'.*\';:var remote = \'$GH_REMOTE_NAME\';:" ../src/components/MenuBar.jsx
sed -i -e "s:var branch = \'.*\';:var branch = \'$BRANCH\';:" ../src/components/MenuBar.jsx
fi