UNPKG

net-cli

Version:
47 lines (39 loc) 1.42 kB
#!/usr/bin/env node const { program } = require('commander'); const { initProject, initSubProject } = require('../lib/index'); const { version } = require('../package.json'); program.version(version); program .command('init <name>') .description('init a project') .option('-T, --type <typeName>', 'select project type') .option('--vueVersion <version>', 'select vue version') .option('-S, --project <projectName>', 'sub project name') .option('-C, --config <config>', 'config json') .action((name, { vueVersion }) => { initProject({ downloadPath: name, vueVersion, }); }); program .command('initSubProject <name>') .description('init a sub project in src/project') .option('-T, --type <typeName>', 'select sub project type') .option('--vueVersion <version>', 'select vue version') .option('-C, --config <config>', 'config json') .option('-B, --businessType <businessType>', '业务类型(1表示商家,2表示赛事)') .action((name, { type, vueVersion, config }) => { console.log('[initSubProject] name', name); console.log('[initSubProject] type', type); console.log('[initSubProject] config', config); console.log('[initSubProject] downloadPath', process.cwd()); initSubProject({ subProjectName: name, downloadPath: process.cwd(), type, vueVersion, config, }); }); program.parse(process.argv);