forked from flatlogic/react-native-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.js
50 lines (49 loc) · 1.56 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
module.exports = function (plop) {
plop.setGenerator('screen', {
description: 'Generates new Screen',
prompts: [{
type: 'input',
name: 'name',
message: 'Screen name (Casing will be modified)',
}],
actions: [
{
type: 'add',
path: 'src/screens/{{properCase name}}Screen.js',
templateFile: 'generators/screen/Screen.js.hbs',
},
{
type: 'add',
path: 'src/containers/{{properCase name}}Screen.js',
templateFile: 'generators/screen/ScreenContainer.js.hbs',
},
],
});
plop.setGenerator('reducer', {
description: 'Generates new reducer',
prompts: [{
type: 'input',
name: 'name',
message: 'Reducer name (Casing will be modified)',
}],
actions: [
{
type: 'add',
path: 'src/reducers/{{camelCase name}}/index.js',
templateFile: 'generators/reducer/reducer.js.hbs',
},
{
type: 'modify',
path: 'src/reducers/reducer.js',
pattern: /\/\/ ## Generator Reducer Imports/gi,
template: '// ## Generator Reducer Imports\nimport {{properCase name}}Reducer from \'./{{camelCase name}}\';',
},
{
type: 'modify',
path: 'src/reducers/reducer.js',
pattern: /\/\/ ## Generator Reducers/gi,
template: '// ## Generator Reducers\n\n {{camelCase name}}: {{properCase name}}Reducer,',
},
],
});
};