UNPKG

epmp-cli

Version:

A simple init for epm scaffolding projects.

74 lines (68 loc) 1.88 kB
/** * EPMP 微服务前端工程最佳实践脚手架生成工具 * @author zhaoyuu(zhaoyuu@yonyou.com) * @date 2020-09-14 15:51:35 */ const chalk = require('chalk'); const getDownloadUcf = require('./getDownloadUcf'); const getNewModule = require('./getNewModule'); const getUcfPkg = require('./getUcfPkg'); const getNewNode=require('./getNewNode'); // const getAutoUpdate = require('./getAutoUpdate'); //第一时间检测是否有最新版本给出提升自行升级或者是热更新模板 // getAutoUpdate(); function getHelp() { console.log(chalk.green.bold(' Usage : ')); console.log(); console.log(chalk.green(' epmp init \t 🚀 Create a standard microservice front-end project')); console.log(); console.log( chalk.green( ' epmp new app \t ☁️ Create a module page \n \t\t ⚠️ There are two types of pages: separate pages and separate pages containing routing.' ) ); console.log(); // process.exit(0); } function getVersion() { console.log(chalk.green('👉 ' + require('../package.json').version)); // process.exit(0); } module.exports = { plugin: function (options) { commands = options.cmd; pluginname = options.name; if (options.argv.h || options.argv.help) { getHelp(); } if (options.argv.v || options.argv.version) { getVersion(); } // if (options.argv._.length == 0) { // getHelp(); // } // console.log({ // options, // "options.argv": JSON.stringify(options.argv) // }) let action = options.argv._[0], param = options.argv._[1]; switch (action) { case 'init': getDownloadUcf(param); break; case 'new': getNewModule(param); break; case 'list': getUcfPkg(); break; case 'node': getNewNode(); break; default: // getHelp(); break; } }, };