UNPKG

bm_scaffold_async_router

Version:

本木前端脚手架-异步路由版

82 lines (75 loc) 2.78 kB
var path = require('path'), erosUpdate = require('./update'), erosConsole = require('./util').erosConsole, readSyncByRl = require('./util').readSyncByRl, Process = require('child_process'); function select() { var tip = `[` + 'bm-eros'.blue + `] 加载和更新依赖,请选择对应更新平台编号: ` + ` tip: 本功能会执行 ios 和 android 下的 install.sh 更新脚本。`.yellow + ` 1 --- ios weex-eros 基础组件和模块SDK 2 --- android weex-eros 基础组件和模块SDK 3 --- fe weex-eros 前端组件库 ` readSyncByRl(tip).then(function(res) { if (res == 1) { iosDep(); return; } if (res == 2) { androidDep(); return; } if (res == 3) { components(); return; } erosConsole('输入错误,需要填写选项编号,请重新运行指令'.red) }); } function iosDep() { erosConsole('开始更新和加载 ios 基础组件模块SDK'.green) console.time('[' + 'bm-eros'.blue + '] ' + 'ios更新总时长:'.green); var build = Process.exec(path.resolve(process.cwd(), '../ios/WeexEros/install.sh'), { cwd: path.resolve(process.cwd(), '../ios/WeexEros/') }, function(error, stdout, stderr) { // window上防止报错 // if (error !== null) { // erosConsole('exec error: ' + error, 'red'); // return; // } console.timeEnd('[' + 'bm-eros'.blue + '] ' + 'ios更新总时长:'.green); }); build.stdout.on('data', function(data) { console.log(data) }); build.stderr.on('data', function(data) { console.log(data) }); }; function androidDep() { erosConsole('开始更新和加载 android 基础组件模块SDK'.green) console.time('[' + 'bm-eros'.blue + '] ' + 'android更新总时长:'.green); var build = Process.exec(path.resolve(process.cwd(), '../android/WeexFrameworkWrapper/install.sh'), { cwd: path.resolve(process.cwd(), '../android/WeexFrameworkWrapper/') }, function(error, stdout, stderr) { // if (error !== null) { // erosConsole('exec error: ' + error, 'red'); // return; // } console.timeEnd('[' + 'bm-eros'.blue + '] ' + 'android更新总时长:'.green); }); build.stdout.on('data', function(data) { console.log(data) }); build.stderr.on('data', function(data) { console.log(data) }); }; function components() { erosConsole('开始更新下载 eros 组件库'.green); erosUpdate.updateProject('fe/src/js/components/__eros__'); }; module.exports = { select: select, iosDep: iosDep, androidDep: androidDep, components: components }