#!/bin/bash
set -e
cd ..

echo "1.build目录创建,如果没有build 目录，请先构建"

if [ ! -d "build" ]; then
  mkdir build
fi
cd ./build
# 移除上次的记录。
rm -rf enoad-component-web 
cd ..
echo "2.开始复制全部文件到build中"
pwd
cp -r ./enoad-component-web ./build/enoad-component-web
cd ./build/enoad-component-web
rm -rf node_modules
echo "3.开始在build中编译安装依赖"
yarn

echo "4.查看代码是否符合规范"
yarn build

#5. 开始构建
echo "5.开始构建"
rm -rf sdk
rm -rf lib

echo "6.生成npm包"
fis3 release publish -c

# 【前后端分离】以前的打包样式进行移除、使用最新打包样式，直接上传到npm服务中。进行远程引用。
#echo "darlyyuhui"
#echo "darly13891431454"
#echo "darlyyuhui@hotmail.com"
npm login
npm publish
# 删除该包npm unpublish enoad-component-web@2.1.4
# 

# echo "7.生成sdk包"
# fis3 release publish-sdk  -c 

# echo "8.复制到测试Example"
# cp -r ./sdk ../../example/public/example-web/
# pwd

# echo "9.复制到测试Customer"
# cp -r ./sdk /Users/fronchdarly/WorkSpace/StudyDay/dubbo/Dubbo-System/Dubbo-Customer/src/main/webapp/entity
# pwd


# echo "10.复制到测试Service服务"
# cp -r ./sdk /Users/fronchdarly/WorkSpace/Enoad/Ser/darly-enoad-service/public/javascripts
# pwd
