You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

21 lines
600 B

#!/usr/bin/env node
const path = require('path');
const cmds = require('./src/cmd');
const program = require('commander');
const getConfig = require('./src/utils/getConfig');
const pkg = require(path.join(__dirname, './package.json'));
program
.version(pkg.version)
.option('-d, --dev', '本地开发')
.option('-e, --editor', '开启编辑器')
.option('-i, --init', '初始化配置文件')
.parse(process.argv);
Object.keys(cmds).forEach((cmd) => {
const CmdCtor = cmds[cmd];
if (program[cmd]) {
const cmdInst = new CmdCtor({ config: getConfig() });
cmdInst.run();
}
});