-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.js
68 lines (66 loc) · 2.28 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
56
57
58
59
60
61
62
63
64
65
66
67
68
module.exports = function(plop) {
/* welcome messag that will display in CLI */
plop.setWelcomeMessage(
'Welcome to plop! What type of file would you like to generate?'
),
/* name and description of our template */
plop.setGenerator('generate blog post ✏️', {
description: 'Template for generating blog posts',
prompts: [
/* inquirer prompts */
/* questions we want to ask in CLI and save questions for*/
{
type: 'input',
name: 'module',
message: 'Name of the module:',
},
{
type: 'input',
name: 'description',
message: 'Description of the module:',
},
{
type: 'list',
name: 'category',
message: 'Category:',
choices: ['Atoms', 'Widgets'],
filter: function(val) {
return val.toLowerCase()
}
},
{
type: 'confirm',
name: 'isInput',
message: 'Do you want an input Element?'
}
],
actions: [
/* what should be generated based off of the above prompts */
{
type: 'add',
path: `src/{{category}}/{{dashCase module}}/main.config.js`,
templateFile: 'scaffolding/templates/config.hbs',
},
{
type: 'add',
path: `src/{{category}}/{{dashCase module}}/main.style.js`,
templateFile: 'scaffolding/templates/style.hbs',
},
{
type: 'add',
path: `src/{{category}}/{{dashCase module}}/main.template.js`,
templateFile: 'scaffolding/templates/template.hbs',
},
{
type: 'add',
path: `src/{{category}}/{{dashCase module}}/main.js`,
templateFile: 'scaffolding/templates/main.hbs',
},
{
type: 'add',
path: `src/{{category}}/{{dashCase module}}/main.stories.js`,
templateFile: 'scaffolding/templates/stories.hbs',
}
]
})
}