#!/bin/sh -l
git pull

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

# 初始化项目

# 若使用lerna管理packages需要执行如下命令
lerna bootstrap --registry http://nexus.saas.hand-china.com/content/groups/hzero-npm-group/

yarn --registry http://nexus.saas.hand-china.com/content/groups/hzero-npm-group/

# build dll: 本项目开启webpack dll插件,若dll目录不存在,则在执行启动/build操作之前,请务必执行如下命令
# yarn build:dll

# hzero-front主体工程依赖于packages下的各模块,所以需要编译packages下的各模块,执行如下命令
# yarn transpile:prod

yarn build:production

find dist -name '*.js' | xargs sed -i "s BUILD_API_HOST http://192.168.16.172 g"
find dist -name '*.js' | xargs sed -i "s BUILD_CLIENT_ID hzero-front-dev g"
find dist -name '*.js' | xargs sed -i "s BUILD_BPM_HOST http://192.168.16.172:8330 g"
find dist -name '*.js' | xargs sed -i "s BUILD_WEBSOCKET_HOST ws://192.168.16.172:8260 g"


rm -rf html
mv dist html
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"

