#!/bin/bash
set -e # 如果构建失败，则退出，不能删除旧的包
if [ "$#" -ne 1 ] ; then
  echo "Usage: $0 BUILD_ENV" >&2
  exit 1
fi

pwd

echo “build env: $1”

pwd

yarn
npm run build

mkdir -p ~/project/marking-cet/static/temp
cp -r  dist/web ~/project/marking-cet/static/temp

cd ~/project/marking-cet/static
if [ -d "dist" ]; then
  rm -rf dist/*
fi

mkdir -p dist

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