#!/bin/bash
WEB="web"
DIST="dist"
RED=\033[0:31m
GREEN=\033[0;32m
NC=\033[0m
#生产打包传参
BUILD="b"
if [ -e ${WEB} ];then#删历史文件rm -r ${WEB}rm ${WEB}.zip
fi
#编辑文件
npm run build
#检查构建是否成功
if[ -e ${DIST} ];then#改名mv ${DIST} ${WEB}#压缩if[ "$1" == $BUILD ];thenzip −r ${WEB}.zip ${WEB}fiprintf "${GREEN} success!!!!!!! ${NC}\n"
elseprintf "${RED) failure!!!!!!!!!! ${NC}\n"
fi