feat: add tip and set taobao npm registry

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-07-10 00:16:03 +08:00
parent 71b17dd7b6
commit 8bb6eb6f8c

View File

@ -49,6 +49,7 @@ info "开始检测运行环境..."
if [[ -z "$(which node)" ]]; then
if [[ ! -d node ]]; then
warn "未安装NodeJS 开始下载二进制包 请稍候..."
info "下载过程根据您的网络状况可能需要 1-10 分钟..."
curl -o node.zip https://nodejs.org/dist/v10.16.0/node-v10.16.0-win-x64.zip
info "下载完成 开始解压Node环境 请稍候..."
unzip -q node.zip
@ -69,12 +70,16 @@ fi
echo "NodeJS 二进制版本: $(${NODE} -v)"
if [[ ! -d tera ]]; then
warn "未找到 Tera 源代码 开始Clone项目 请稍候..."
info "下载过程根据您的网络状况可能需要 1-5 分钟..."
git clone https://git.yumc.pw/502647092/tera.git
fi
TERA_ROOT=${ROOT}/tera/Source
cd "${TERA_ROOT}"
if [[ ! -d node_modules ]]; then
warn "未安装依赖 开始安装 请稍候..."
info "设置镜像源为 https://registry.npm.taobao.org"
"${NPM}" config set registry https://registry.npm.taobao.org
info "安装过程根据您的网络状况可能需要 1-5 分钟..."
"${NPM}" install
fi
@ -113,7 +118,7 @@ echo "setTimeout(()=>require('child_process').exec('start http://127.0.0.1'), 50
"${NODE}" temp.js && info "启动完成 打开系统默认浏览器..." && rm -rf temp.js &
while true; do
"${NODE}" run-node.js
echo "程序已关闭 将在3秒后重启 Ctrl + C 取消运行..."
warn "程序已关闭 将在3秒后重启 Ctrl + C 取消运行..."
sleep 3
clear
done