export default plop => { plop.setGenerator('domain', { description: '生成一个领域', prompts: [ { type: 'input', name: 'name', message: 'domain name: ' } ], actions: [ { type: 'add', path: 'src/views/{{name}}/{{properCase name}}.vue', templateFile: 'plop-template/view.hbs' }, { type: 'add', path: 'src/domain/{{name}}/api.ts', templateFile: 'plop-template/api.hbs' }, { type: 'add', path: 'src/domain/{{name}}/service.ts', templateFile: 'plop-template/service.hbs' }, { type: 'append', pattern: /(?=(\/\/ -- APPEND HERE --))/gi, path: 'src/router/asyncRouter.ts', templateFile: 'plop-template/router.hbs' } ] }) plop.setHelper('upperCase', string => string.charAt(0).toUpperCase() + string.slice(1)) }