|
|
@@ -5,7 +5,7 @@ export default plop => {
|
|
|
{
|
|
|
type: 'input',
|
|
|
name: 'name',
|
|
|
- message: 'domain name: '
|
|
|
+ message: '领域名称: '
|
|
|
}
|
|
|
],
|
|
|
actions: [
|
|
|
@@ -32,5 +32,29 @@ export default plop => {
|
|
|
}
|
|
|
]
|
|
|
})
|
|
|
+
|
|
|
+ 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))
|
|
|
}
|