-
Notifications
You must be signed in to change notification settings - Fork 140
/
plopfile.js
66 lines (65 loc) · 1.94 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
54
55
56
57
58
59
60
61
62
63
64
65
66
module.exports = (plop) => {
// create your generators here
plop.setGenerator('basic component', {
description: 'this will create a ui component with all necessary subitems - test, scss etc',
prompts: [{
type: 'input',
name: 'name',
message: 'Please name your component',
}], // array of inquirer prompts
actions: [{
// add jsx
type: 'add',
path: 'src/ui/{{name}}/index.tsx',
templateFile: 'plop-templates/ui/tsx.hbs',
}, {
// add scss
type: 'add',
path: 'src/ui/{{name}}/index.scss',
templateFile: 'plop-templates/ui/scss.hbs',
}, {
// add test
type: 'add',
path: 'src/ui/{{name}}/__tests__/{{name}}.spec.js',
templateFile: 'plop-templates/ui/test.hbs',
}, {
// add story
type: 'add',
path: 'src/ui/{{name}}/stories/{{name}}.stories.js',
templateFile: 'plop-templates/ui/stories.hbs',
}],
});
plop.setGenerator('basic reducer', {
description: 'this will create a reducer component with all necessary subitems',
prompts: [{
type: 'input',
name: 'name',
message: 'Name your reducer',
}, {
type: 'input',
name: 'path',
message: 'Where should we put your reducer? ex: `src/modules/Channel/context/dux`',
}], // array of inquirer prompts
actions: [{
// add initial state
type: 'add',
path: '{{path}}/initialState.ts',
templateFile: 'plop-templates/reducer/initialState.hbs',
}, {
// add actionType
type: 'add',
path: '{{path}}/actionTypes.ts',
templateFile: 'plop-templates/reducer/actionTypes.hbs',
}, {
// add reducer
type: 'add',
path: '{{path}}/reducer.ts',
templateFile: 'plop-templates/reducer/reducer.hbs',
}, {
// add test
type: 'add',
path: '{{path}}/__tests__/{{camelCase name}}Reducer.spec.js',
templateFile: 'plop-templates/reducer/test.hbs',
}],
});
};