Skip to content

Commit fab1c31

Browse files
committed
chore: add plopfile
1 parent 26fb7b3 commit fab1c31

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

.DS_Store

0 Bytes
Binary file not shown.

template/plopfile.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
module.exports = (plop) => {
2+
plop.setGenerator('component', {
3+
description: 'Create a component',
4+
// User input prompts provided as arguments to the template
5+
prompts: [
6+
{
7+
// Raw text input
8+
type: 'input',
9+
// Variable name for this input
10+
name: 'name',
11+
// Prompt to display on command line
12+
message: 'What is your component name?',
13+
},
14+
],
15+
actions: [
16+
{
17+
// Action type 'append' injects a template into an existing file
18+
type: 'append',
19+
path: 'src/components/stories.ts',
20+
// Pattern tells plop where in the file to inject the template
21+
pattern: `/* PLOP_INJECT_IMPORT */`,
22+
template: `import './molecules/{{pascalCase name}}/stories';`,
23+
},
24+
{
25+
// Add a new file
26+
type: 'add',
27+
// Path for the new file
28+
path: 'src/components/molecules/{{pascalCase name}}/{{pascalCase name}}.tsx',
29+
// Handlebars template used to generate content of new file
30+
templateFile: 'plop-templates/Component.js.hbs',
31+
},
32+
{
33+
// Add a new file
34+
type: 'add',
35+
// Path for the new file
36+
path: 'src/components/molecules/{{pascalCase name}}/stories.tsx',
37+
// Handlebars template used to generate content of new file
38+
templateFile: 'plop-templates/Stories.js.hbs',
39+
},
40+
{
41+
// Add a new file
42+
type: 'add',
43+
// Path for the new file
44+
path: 'src/components/molecules/{{pascalCase name}}/index.tsx',
45+
// Handlebars template used to generate content of new file
46+
templateFile: 'plop-templates/ExportIndex.js.hbs',
47+
},
48+
],
49+
});
50+
};

0 commit comments

Comments
 (0)