-
Notifications
You must be signed in to change notification settings - Fork 2
/
plopfile.js
41 lines (41 loc) · 1.06 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
// eslint-disable-next-line import/no-default-export
module.exports = async (plop) => {
plop.setGenerator('component', {
description: 'Create a new component',
prompts: [
{
type: 'input',
name: 'name',
message: 'What is your component name?',
validate: (value) => {
if (/.+/.test(value)) {
return true
}
return 'The name is required'
},
},
],
actions: [
{
type: 'add',
path: 'src/components/{{kebabCase name}}/index.tsx',
templateFile: '.plop/templates/index.tsx.hbs',
},
{
type: 'add',
path: 'src/components/{{kebabCase name}}/stories.tsx',
templateFile: '.plop/templates/stories.tsx.hbs',
},
{
type: 'add',
path: 'src/components/{{kebabCase name}}/test.tsx',
templateFile: '.plop/templates/test.tsx.hbs',
},
{
type: 'eslint',
path: 'src/components/{{kebabCase name}}/*.tsx',
},
],
}),
await plop.load('plop-action-eslint')
}