diff --git a/bin/config.js b/bin/config.js index 33e71a3..eccdaad 100644 --- a/bin/config.js +++ b/bin/config.js @@ -5,17 +5,9 @@ const frame = [ message: '选择什么框架去新建项目❓', name: 'type', choices: [ - { name: 'react', value: 'react' }, - { name: 'vue', value: 'vue' }, - ], - }, - { - type: 'list', - message: '是否使用TypeScript❓', - name: 'isTypeScript', - choices: [ - { name: '是', value: 'ts' }, - { name: '否', value: 'js' }, + { name: '创建react项目', value: 'react' }, + { name: '创建vue项目', value: 'vue' }, + { name: '创建大屏项目', value: 'large' }, ], }, ]; @@ -43,7 +35,19 @@ const vue = [ choices: [ { name: 'pina', value: 'pina' }, { name: 'vuex', value: 'vuex' }, - { name: '大屏pina仓库rem', value: 'large_rem' }, + ], + }, +]; + +// large +const large = [ + { + type: 'list', + message: '📺选择大屏模板', + name: 'large', + choices: [ + { name: '大屏vue+pina仓库rem', value: 'vue_large_rem' }, + { name: '大屏vue+pina仓库scale', value: 'vue_large_scale' }, ], }, ]; @@ -52,18 +56,14 @@ const vue = [ module.exports = { // 项目列表 projectList: { - 'vue&js&vuex': 'https://gitee.com/BunnyBoss/vue_js_vuex.git', - 'vue&js&pina': 'https://gitee.com/BunnyBoss/vue_js_pina.git', - 'vue&ts&vuex': 'https://gitee.com/BunnyBoss/vue_ts_vuex.git', - 'vue&ts&pina': 'https://gitee.com/BunnyBoss/vue_ts_pina.git', - 'vue&ts&large_rem': 'https://gitee.com/BunnyBoss/vue_ts_large_rem.git', - 'react&js&userouter': 'https://gitee.com/BunnyBoss/Bunny-Cli/react_js_userouter.git', - 'react&ts&userouter': 'https://gitee.com/BunnyBoss/Bunny-Cli/react_ts_userouter.git', - 'react&js&RouterProvider': 'https://gitee.com/BunnyBoss/Bunny-Cli/react_js_routerprovider.git', - 'react&ts&RouterProvider': 'https://gitee.com/BunnyBoss/Bunny-Cli/react_ts_routerprovider.git', - 'react&ts&zustand': 'https://gitee.com/BunnyBoss/Bunny-Cli/react_ts_zustand.git', - 'react&js&zustand': 'https://gitee.com/BunnyBoss/Bunny-Cli/react_js_zustand.git', + 'vue&vuex': 'https://gitee.com/BunnyBoss/vue_ts_vuex.git', + 'vue&pina': 'https://gitee.com/BunnyBoss/vue_ts_pina.git', + 'large&vue_large_rem': 'https://gitee.com/BunnyBoss/vue_ts_large_rem.git', + 'large&vue_large_scale': 'https://gitee.com/BunnyBoss/vue_ts_large_scale.git', + 'react&userouter': 'https://gitee.com/BunnyBoss/Bunny-Cli/react_ts_userouter.git', + 'react&RouterProvider': 'https://gitee.com/BunnyBoss/Bunny-Cli/react_ts_routerprovider.git', + 'react&zustand': 'https://gitee.com/BunnyBoss/Bunny-Cli/react_ts_zustand.git', }, // 问题 - question: { frame, react, vue }, + question: { frame, react, vue, large }, }; diff --git a/bin/utils.js b/bin/utils.js index b71dd2d..e79bfad 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -39,19 +39,26 @@ module.exports = { async createProject() { // 选择框架和语言 const frame = await inquirer.prompt(question.frame); - const frame_isTypeScript = `${frame.type}&${frame.isTypeScript}`; + const frameType = `${frame.type}`; // 如果选择的react框架 if (frame.type === 'react') { const awsaner = await inquirer.prompt(question.react); - const key = `${frame_isTypeScript}&${awsaner.router}`; - return projectList[key]; + const key = `${frameType}&${awsaner.router}`; + + return projectList[key]; // 匹配选择内容 } // 如果选择是vue框架 - else { + else if (frame.type === 'vue') { const awsaner = await inquirer.prompt(question.vue); - const key = `${frame_isTypeScript}&${awsaner.router}`; - return projectList[key]; + const key = `${frameType}&${awsaner.router}`; + + return projectList[key]; // 匹配选择内容 + } else if (frame.type === 'large') { + const awsaner = await inquirer.prompt(question.large); + const key = `${frameType}&${awsaner.large}`; + + return projectList[key]; // 匹配选择内容 } }, /** @@ -67,14 +74,15 @@ module.exports = { if (fs.existsSync(targetPath, '.git')) { fs.remove(path.join(targetPath, '.git')); } + const overText = ` -⚓ vue大屏默认pinia仓库,安装Vue-ECharts,使用rem布局 +⚓ 1. vue大屏默认pinia仓库,安装Vue-ECharts,使用rem布局 +⚓ 2. vue大屏默认pinia仓库,安装Vue-ECharts,使用scale布局 -📄 Generating README.md... +📄 请查看 README.md... -🎉 Successfully created project ${name} -👉 Get started with the following commands: - `; +🎉 成功创建项目 ${name} +👉 快速使用编辑器或命令行开始开发吧`; console.log(overText); console.log(chalk.whiteBright('Happy hacking!')); } catch (error) { diff --git a/package-lock.json b/package-lock.json index 0c03bdb..002aa9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bunny-cli", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "bunny-cli", - "version": "1.0.2", + "version": "1.0.3", "license": "ISC", "dependencies": { "chalk": "^4.0.0",