#!/bin/bash
pwd

yarn
npm run build

mkdir -p ~/project/exam-reserve/web/temp
cp -r  dist ~/project/exam-reserve/web/temp

cd ~/project/exam-reserve/web
if [ -d "dist" ]; then
  currentTime=`date "+%Y%m%d%H%M%S"`
  echo "dist backup... $currentTime"
  tar cf web-bak-$currentTime.tar.gz dist
  rm -rf dist/*
fi

mv temp/dist .
rm -rf temp
echo "ok..."

