This repository has been archived by the owner on Jul 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathplopfile.js
55 lines (54 loc) · 1.69 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
const actions = [{
type: 'add',
path: 'src/{{ type }}/{{ pascalCase name }}/index.js',
templateFile: '.plop/Component/index.js',
}, {
type: 'add',
path: 'src/{{ type }}/{{ pascalCase name }}/{{ pascalCase name }}.jsx',
templateFile: '.plop/Component/Component.jsx',
}, {
type: 'add',
path: 'src/{{ type }}/{{ pascalCase name }}/{{ pascalCase name }}.test.jsx',
templateFile: '.plop/Component/Component.test.jsx',
}, {
type: 'add',
path: 'src/{{ type }}/{{ pascalCase name }}/{{ pascalCase name }}.stories.jsx',
templateFile: '.plop/Component/Component.stories.jsx',
}, {
type: 'add',
path: 'src/{{ type }}/{{ pascalCase name }}/README.md',
templateFile: '.plop/Component/README.md',
}, {
type: 'modify',
pattern: /$/,
path: 'src/{{ type }}/index.js',
template: `export { default as {{ pascalCase name }} } from './{{ pascalCase name }}'
`,
}, {
type: 'modify',
pattern: /$/,
path: 'src/index.js',
template: `export { {{ pascalCase name }} } from './{{ type }}'
`,
}]
module.exports = plop => {
plop.setGenerator('component', {
description: 'create a new atomic component',
prompts: [{
type: 'list',
name: 'type',
message: 'Type of component',
choices: [
{ name: 'Atom', value: 'Atoms' },
{ name: 'Molecule', value: 'Molecules' },
{ name: 'Organism', value: 'Organisms' },
{ name: 'Template', value: 'Templates' },
],
}, {
type: 'input',
name: 'name',
message: 'The name of the component',
}],
actions,
})
}