-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.js
55 lines (54 loc) · 1.75 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
module.exports = (plop) => {
plop.setGenerator('component', {
description: 'Create a new React component',
// User input prompts provided as arguments to the template
prompts: [
{
// Raw text input
type: 'input',
// Variable name for this input
name: 'name',
// Prompt to display on command line
message: 'What is your components name?',
},
],
actions: [
{
// Add a new file
type: 'add',
// Path for the new file
path: 'src/components/{{pascalCase name}}/{{lowerCase name}}.stories.tsx',
// Handlebars template used to generate content of new file
templateFile: '.plop-templates/component/stories.tsx.hbs',
skipIfExists: true,
},
{
// Add a new file
type: 'add',
// Path for the new file
path: 'src/components/{{pascalCase name}}/{{lowerCase name}}.tests.tsx',
// Handlebars template used to generate content of new file
templateFile: '.plop-templates/component/tests.tsx.hbs',
skipIfExists: true,
},
{
// Add a new file
type: 'add',
// Path for the new file
path: 'src/components/{{pascalCase name}}/index.ts',
// Handlebars template used to generate content of new file
templateFile: '.plop-templates/component/index.ts.hbs',
skipIfExists: true,
},
{
// Add a new file
type: 'add',
// Path for the new file
path: 'src/components/{{pascalCase name}}/{{pascalCase name}}.tsx',
// Handlebars template used to generate content of new file
templateFile: '.plop-templates/component/Component.tsx.hbs',
skipIfExists: true,
},
],
});
};