##### BACK END #####
git clone git@ssh.dev.azure.com:v3/HackKu/HackKu%202020/backend backend
cd backend
yarn install
cp build.env .env
    #### THIS WILL BE MISSING THE DB CREDENTIALS
    #### USE echo TO APPEND THE DB CREDENTIALS TO THE .env FILE SO WE DON'T HAVE THEM IN GIT
node flitter test
    #### IF THIS WORKS, DO THE DEPLOY TO PRODUCTION

#### DEPLOYMENT FOR BACKEND ####
#### RUN THESE COMMANDS SSH'D INTO THE PROD VM
cd {path to app folder}
systemctl stop app-backend.service
git pull
rm -rf node_modules
yarn install
systemctl start app-backend.service

##### FRONT END #####
git clone git@ssh.dev.azure.com:v3/HackKu/HackKu%202020/frontend frontend
cd frontend
npm i
ionic build --prod
tar czvf target-www.tar.gz ./www

##### target-www.tar.gz is the artifact! #####
#### DEPLOYMENT FOR BACKEND ####
cd {path to app folder}
systemctl stop app-backend.service
rm -rf www.bak
mkdir -p www
mv www www.bak
cp /path/to/target-www.tar.gz .
tar xvzf target-www.tar.gz
    #### THIS CREATES A NEW www DIRECTORY
sed -i 's/base href="\/"/base href="\/i\/"/g' www/index.html
    #### THIS FIXES THE ROUTE PREFIX HANDLING FOR IONIC
