hzd-weeklyexam
v2.0.0
Published
```js #!/usr/bin/env node
Downloads
1
Readme
#!/usr/bin/env node
const program = require("commander");
const inquirer = require("inquirer");
const fs=require("fs");
const path=require("path");
program.description("hello").version("1.0.0");
inquirer.prompt([
{
type: "input",
name: "project",
message: "请输入项目名称"
},
{
type:"list",
name:"choices",
message:"确认创建?",
choices:["yes(确认)","cancel(取消)"]
},
{
type: "list",
name: "action",
message: "选择项目类型",
choices:["vue","react"]
}
]).then(res => {
if(res.choices==="yes(确认)"){
fs.mkdirSync(res.project)
if(res.action==="vue"){
fs.writeFileSync(path.join(res.action+".vue"),"","utf-8")
}else{
fs.writeFileSync(path.join(res.action+".jsx"),"","utf-8")
}
}
})
program.parse(program.argv);