UNPKG

comb-cli

Version:

comb cli

34 lines (31 loc) 1.27 kB
#!/usr/bin/env node const createJson = require('./createJson.js'); const config = require('./config.json'); const path = require('path'); const process = require('process'); const rootPath = process.cwd(); require('shelljs/global'); const prompt = require('./prompt.js'); const downLoadFrame = require('./downLoadFrame.js'); const targetPath = path.resolve(rootPath, config.frame.tempDir, '../'); module.exports = function createCombJson (combJsonOpt) { const jsonPath = path.resolve(targetPath, 'comb.json'); return new Promise ((resolve, reject) => { prompt('是否指定框架版本号?(y/n)', /[n|y]/).then((answer) => { if ('y' === answer) { prompt('输入框架版本号(1.0.0)',/^\d+\.\d+\.\d+$/).then((res) => { combJsonOpt.version = res; createJson(combJsonOpt, jsonPath).then((data) => { echo('comb.json创建成功'.green); resolve(data); }); }); } else { createJson(combJsonOpt, jsonPath).then((data) => { echo('comb.json创建成功'.green); resolve(data); }); } }); }); };