-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathrunForDev.sh
executable file
·55 lines (53 loc) · 2.29 KB
/
runForDev.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
#!/bin/bash
# Uncomment below if you need to see the minified version....
# export buildTarget="PROD"
PORTAL_DIR=/opt/redbox-portal
PORTAL_IMAGE=qcifengineering/redbox-portal:latest
source dev_build/buildFns.sh
sudo chown -R vagrant:vagrant *
watch="false"
# Not really needed but I'm putting this in a for loop in case we want to add more arguments later
for var in "$@"
do
if [ $var = "install" ]; then
docker run -it --rm -v $PWD:$PORTAL_DIR $PORTAL_IMAGE /bin/bash -c "cd $PORTAL_DIR; npm install -g yarn; yarn add sails-hook-autoreload && yarn global add typings && yarn install"
fi
if [ $var = "jit" ]; then
linkNodeLib "lodash" "lodash-lib"
# Build targets are different for assets/angular, clearing all .js files from .ts files
cleanUpAllJs
export ENV=development
docker run -it --rm -v $PWD:$PORTAL_DIR $PORTAL_IMAGE /bin/bash -c "cd $PORTAL_DIR; npm install -g @angular/cli; npm install -g yarn; yarn install --only=dev; node_modules/.bin/tsc --project tsconfig.json; cd angular; yarn; make build-frontend"
fi
if [ $var = "jit-skip-frontend" ]; then
linkNodeLib "lodash" "lodash-lib"
export ENV=development
docker run -it --rm -v $PWD:$PORTAL_DIR $PORTAL_IMAGE /bin/bash -c "cd $PORTAL_DIR; npm install -g @angular/cli; npm install -g yarn; yarn install --only=dev; node_modules/.bin/tsc --project tsconfig.json;"
fi
if [ $var == "aot" ]; then
docker run -it --rm -v $PWD:$PORTAL_DIR $PORTAL_IMAGE /bin/bash -c "cd $PORTAL_DIR; export buildTarget=\"${buildTarget}\"; ./runForDev.sh aotCompile"
export ENV=development
export FORCE_BUNDLE=1
fi
if [ $var == "aotCompile" ]; then
cleanUpAllJs
linkNodeLib "lodash-es" "lodash-lib"
echo "declare module 'lodash-lib';" > "node_modules/lodash-es/index.d.ts"
compileAoT
exit 0
fi
if [[ $var == watch=* ]]; then
ng2App=$(cut -d "=" -f 2 <<< "$var")
watch="true"
fi
done
if [ $watch == "true" ]; then
echo "Running watch"
nohup docker-compose up &
sleep 15
RBPORTAL_PS=$(docker ps -f name=redbox-portal_redboxportal_1 -q)
docker exec -it $RBPORTAL_PS /bin/bash -c "cd /opt/redbox-portal/angular; npm install -g @angular/cli; yarn; ng build --app=${ng2App} --watch"
else
echo "No watch"
docker-compose up
fi