#!/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-without-type-check mkdir -p ~/project/exam-score-statistic/static-new/temp cp -r dist ~/project/exam-score-statistic/static-new/temp cd ~/project/exam-score-statistic/static-new if [ -d "dist" ]; then currentTime=`date "+%Y%m%d%H%M%S"` echo "dist backup... $currentTime" rm -rf dist/* fi mv temp/dist . rm -rf temp echo "ok..."