-
Notifications
You must be signed in to change notification settings - Fork 2
/
plopfile.js
53 lines (52 loc) · 1.57 KB
/
plopfile.js
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
const _ = require('lodash');
module.exports = function (plop) {
plop.setHelper('capitalise', string => string.charAt(0).toUpperCase() + string.slice(1));
// controller generator
plop.setGenerator('repositoryPattern', {
description: 'repository pattern files for new entity',
prompts: [
{
type: 'input',
name: 'entityName',
message: 'Please enter entity name in camelcase',
},
],
actions: [
{
type: 'add',
path: 'src/resources/{{entityName}}/{{entityName}}.controller.js',
templateFile: 'plop-templates/repositoryPattern/controller.hbs',
},
{
type: 'add',
path: 'src/resources/{{entityName}}/dependency.js',
templateFile: 'plop-templates/repositoryPattern/dependency.hbs',
},
{
type: 'add',
path: 'src/resources/{{entityName}}/{{entityName}}.repository.js',
templateFile: 'plop-templates/repositoryPattern/repository.hbs',
},
{
type: 'add',
path: 'src/resources/{{entityName}}/{{entityName}}.route.js',
templateFile: 'plop-templates/repositoryPattern/route.hbs',
},
{
type: 'add',
path: 'src/resources/{{entityName}}/{{entityName}}.service.js',
templateFile: 'plop-templates/repositoryPattern/service.hbs',
},
{
type: 'add',
path: 'src/resources/{{entityName}}/{{entityName}}.model.js',
templateFile: 'plop-templates/repositoryPattern/model.hbs',
},
{
type: 'add',
path: 'src/resources/{{entityName}}/{{entityName}}.entity.js',
templateFile: 'plop-templates/repositoryPattern/entity.hbs',
},
],
});
};