#!/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/scancentral/web/temp
cp -r  dist ~/project/scancentral/web/temp

cd ~/project/scancentral/web
if [ -d "dist" ]; then
  rm -rf dist/*
fi


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