-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.ts
139 lines (138 loc) · 4.06 KB
/
plopfile.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import { NodePlopAPI } from 'plop';
export default function (plop: NodePlopAPI) {
plop.setGenerator('module', {
description: 'Generate a module',
prompts: [{
type: 'input',
name: 'entity',
message: 'Enter entity name:'
}],
actions: [
{
type: 'add',
path: 'src/app/{{entity}}s/controller/index.ts',
templateFile: 'src/app/Template/Example/controller/index.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/service/index.ts',
templateFile: 'src/app/Template/Example/service/index.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/repository/index.ts',
templateFile: 'src/app/Template/Example/repository/index.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/dto/create.dto.ts',
templateFile: 'src/app/Template/Example/dto/create.dto.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/dto/update.dto.ts',
templateFile: 'src/app/Template/Example/dto/update.dto.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/index.module.ts',
templateFile: 'src/app/Template/Example/index.module.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/index.entity.example.ts',
templateFile: 'src/app/Template/Example/index.entity.example.ts'
},
]
})
plop.setGenerator('module_slug', {
description: 'Generate a module slug',
prompts: [{
type: 'input',
name: 'entity',
message: 'Enter entity name:'
}],
actions: [
{
type: 'add',
path: 'src/app/{{entity}}s/controller/index.ts',
templateFile: 'src/app/Template/ExampleSlug/controller/index.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/service/index.ts',
templateFile: 'src/app/Template/ExampleSlug/service/index.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/repository/index.ts',
templateFile: 'src/app/Template/ExampleSlug/repository/index.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/dto/create.dto.ts',
templateFile: 'src/app/Template/ExampleSlug/dto/create.dto.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/dto/update.dto.ts',
templateFile: 'src/app/Template/ExampleSlug/dto/update.dto.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/index.module.ts',
templateFile: 'src/app/Template/ExampleSlug/index.module.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/index.entity.example.ts',
templateFile: 'src/app/Template/ExampleSlug/index.entity.example.ts'
},
]
})
plop.setGenerator('tree_module', {
description: 'Generate a tree module',
prompts: [{
type: 'input',
name: 'entity',
message: 'Enter entity name:'
}],
actions: [
{
type: 'add',
path: 'src/app/{{entity}}s/controller/index.ts',
templateFile: 'src/app/Template/ExampleTree/controller/index.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/service/index.ts',
templateFile: 'src/app/Template/ExampleTree/service/index.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/repository/index.ts',
templateFile: 'src/app/Template/ExampleTree/repository/index.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/dto/create.dto.ts',
templateFile: 'src/app/Template/ExampleTree/dto/create.dto.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/dto/update.dto.ts',
templateFile: 'src/app/Template/ExampleTree/dto/update.dto.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/index.module.ts',
templateFile: 'src/app/Template/ExampleTree/index.module.ts'
},
{
type: 'add',
path: 'src/app/{{entity}}s/index.entity.example.ts',
templateFile: 'src/app/Template/ExampleTree/index.entity.example.ts'
},
]
})
};