forked from futurice/pepperoni-app-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.js
49 lines (47 loc) · 1.59 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
module.exports = function (plop) {
/* TODO
-----------
** __specs__ for module generator
** Additional prompt for stateless module generator
** Better way to append reducers ? If dev deletes the commented lines it won't work.
** Component generator
** Any way to get name inline ? Like ` plop module name `
**/
plop.setGenerator('module', {
description: 'Generates new module with redux connection',
prompts: [{
type: 'input',
name: 'name',
message: 'Module name (Casing will be modified)'
}],
actions: [
{
type: 'add',
path: 'src/modules/{{camelCase name}}/{{properCase name}}State.js',
templateFile: 'generators/module/ModuleState.js.hbs'
},
{
type: 'add',
path: 'src/modules/{{camelCase name}}/{{properCase name}}View.js',
templateFile: 'generators/module/ModuleView.js.hbs'
},
{
type: 'add',
path: 'src/modules/{{camelCase name}}/{{properCase name}}ViewContainer.js',
templateFile: 'generators/module/ModuleViewContainer.js.hbs'
},
{
type: 'modify',
path: 'src/redux/reducer.js',
pattern: /\/\/ ## Generator Reducer Imports/gi,
template: '// ## Generator Reducer Imports\r\nimport {{properCase name}}Reducer from \'../modules/{{camelCase name}}/{{properCase name}}State\';'
},
{
type: 'modify',
path: 'src/redux/reducer.js',
pattern: /\/\/ ## Generator Reducers/gi,
template: '// ## Generator Reducers\r\n {{camelCase name}}: {{properCase name}}Reducer,'
}
]
});
}