export default plop => { plop.setGenerator('domain', { description: '生成一个领域', prompts: [ { type: 'input', name: 'name', message: '领域名称: ' } ], 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.setGenerator('micro', { description: '生成一个微服务', prompts: [ { type: 'input', name: 'name', message: '微服务名称: ' } ], actions: [ { type: 'add', path: 'src/views/micro/{{properCase name}}.vue', templateFile: 'plop-template/micro.hbs' }, { type: 'append', pattern: /(?=(\/\/ -- APPEND HERE --))/gi, path: 'src/router/asyncRouter.ts', templateFile: 'plop-template/microRouter.hbs' } ] }) plop.setHelper('upperCase', string => string.charAt(0).toUpperCase() + string.slice(1)) }