-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.js
51 lines (51 loc) · 1.47 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
// eslint-disable-next-line import/no-default-export
module.exports = (plop) => {
plop.setGenerator('component', {
description: 'Create a new component',
prompts: [
{
type: 'input',
name: 'name',
message: 'Name of the component?',
validate: (value) => {
if (/.+/.test(value)) {
return true
}
return 'The name is required'
},
},
],
actions: [
{
type: 'add',
path: 'frontend/components/{{properCase name}}/index.ts',
templateFile: '.plop/templates/index.ts.hbs',
},
{
type: 'add',
path: 'frontend/components/{{properCase name}}/{{properCase name}}.tsx',
templateFile: '.plop/templates/component.tsx.hbs',
},
{
type: 'add',
path: 'frontend/components/{{properCase name}}/{{properCase name}}.styles.ts',
templateFile: '.plop/templates/styles.ts.hbs',
},
{
type: 'add',
path: 'frontend/components/{{properCase name}}/{{properCase name}}.stories.tsx',
templateFile: '.plop/templates/stories.tsx.hbs',
},
{
type: 'add',
path: 'frontend/components/{{properCase name}}/{{properCase name}}.test.tsx',
templateFile: '.plop/templates/test.tsx.hbs',
},
{
type: 'add',
path: 'frontend/components/{{properCase name}}/types.ts',
templateFile: '.plop/templates/types.ts.hbs',
},
],
})
}