hzd-weeklyexam

2.0.0 • Public • Published
#!/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);

Readme

Keywords

none

Package Sidebar

Install

npm i hzd-weeklyexam

Weekly Downloads

3

Version

2.0.0

License

ISC

Unpacked Size

2.26 kB

Total Files

3

Last publish

Collaborators

  • hzdnpmzh