UNPKG

qvt-cli

Version:

提供多端响应式设计的模板框架

38 lines (35 loc) 989 B
#!/usr/bin/env node const { inquirerPrompt } = require("./inquirer"); const yargs = require("yargs"); const { checkMkdirExists, copyDir } = require("./copy"); const path = require("path"); const { install } = require("./lib"); yargs.command( ["create", "c"], "快速构建", function (yargs) { return yargs.option("name", { alias: "n", demand: true, describe: "项目名称", type: "string", }); }, function (argv) { inquirerPrompt(argv).then((answers) => { const { name, type } = answers; const isMkdirExists = checkMkdirExists( path.resolve(process.cwd(), `./${name}`) ); if (!isMkdirExists) { copyDir( path.resolve(__dirname, `./template/${type}`), path.resolve(process.cwd(), `./${name}`) ); // install(process.cwd(), answers); } else { console.log(`${name}文件夹已经存在`); } }); } ).argv;