-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.js
128 lines (122 loc) · 3.46 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
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
const mobileRoot = ".";
const screen = {
description: 'generating new screen',
prompts: [
{
type: 'input',
name: 'name',
message: "What's the name of the screen?",
},
],
actions: [
{
type: 'add',
path: `${mobileRoot}/src/screens/{{ pascalCase name }}/index.ts`,
templateFile: 'templates/screen/index.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/screens/{{ pascalCase name }}/{{ camelCase name }}Screen.tsx`,
templateFile: 'templates/screen/screen.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/screens/{{ pascalCase name }}/{{ camelCase name }}Screen.models.ts`,
templateFile: 'templates/screen/models.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/screens/{{ pascalCase name }}/{{ camelCase name }}Screen.test.tsx`,
templateFile: 'templates/screen/test.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/screens/{{ pascalCase name }}/{{ camelCase name }}Screen.i18n.ts`,
templateFile: 'templates/screen/i18n.hbs',
},
],
};
const component = {
description: 'generating new component',
prompts: [
{
type: 'input',
name: 'name',
message: "What's the name of the component?",
},
],
actions: [
{
type: 'add',
path: `${mobileRoot}/src/components/{{ pascalCase name }}/index.ts`,
templateFile: 'templates/component/index.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/components/{{ pascalCase name }}/{{ camelCase name }}.tsx`,
templateFile: 'templates/component/component.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/components/{{ pascalCase name }}/{{ camelCase name }}.models.ts`,
templateFile: 'templates/component/models.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/components/{{ pascalCase name }}/{{ camelCase name }}.styles.tsx`,
templateFile: 'templates/component/styles.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/components/{{ pascalCase name }}/{{ camelCase name }}.test.tsx`,
templateFile: 'templates/component/test.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/components/{{ pascalCase name }}/{{ camelCase name }}.i18n.ts`,
templateFile: 'templates/component/i18n.hbs',
},
],
};
const util = {
description: 'generating new util',
prompts: [
{
type: 'input',
name: 'name',
message: "What's the name of the util?",
},
],
actions: [
{
type: 'add',
path: `${mobileRoot}/src/utils/{{ camelCase name }}/index.ts`,
templateFile: 'templates/util/index.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/utils/{{ camelCase name }}/{{ camelCase name }}.tsx`,
templateFile: 'templates/util/util.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/utils/{{ camelCase name }}/{{ camelCase name }}.models.ts`,
templateFile: 'templates/util/models.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/utils/{{ camelCase name }}/{{ camelCase name }}.test.tsx`,
templateFile: 'templates/util/test.hbs',
},
{
type: 'add',
path: `${mobileRoot}/src/utils/{{ camelCase name }}/{{ camelCase name }}.i18n.ts`,
templateFile: 'templates/util/i18n.hbs',
},
],
};
module.exports = function (plop) {
plop.setGenerator('screen', screen);
plop.setGenerator('component', component);
plop.setGenerator('util', util);
};