github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/static_source/admin/plop/view/prompt.js (about) 1 const toUpperCase = (str) => str.charAt(0).toUpperCase() + str.slice(1) 2 3 module.exports = { 4 description: 'Create vue view', 5 prompts: [ 6 { 7 type: 'input', 8 name: 'path', 9 message: '请输入路径(Please enter a path)', 10 default: 'views' 11 }, 12 { 13 type: 'input', 14 name: 'name', 15 message: '请输入模块名称(Please enter module name)' 16 } 17 ], 18 actions: (data) => { 19 const { name, path } = data 20 const upperFirstName = toUpperCase(name) 21 22 const actions = [] 23 if (name) { 24 actions.push({ 25 type: 'add', 26 path: `./src/${path}/${upperFirstName}.vue`, 27 templateFile: './plop/view/view.hbs', 28 data: { 29 name, 30 upperFirstName 31 } 32 }) 33 } 34 35 return actions 36 } 37 }