-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.mjs
46 lines (46 loc) · 1.12 KB
/
plopfile.mjs
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
export default function (plop) {
plop.setHelper("kebab", (str) => {
return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
});
plop.setGenerator("component", {
description: "generate a component or container",
prompts: [
{
type: "list",
name: "type",
choices: ["component", "container", "route"],
message: "what are you making?",
default: "component",
},
{
type: "confirm",
name: "hasPropInterface",
message: "do you want a props interface?",
default: true,
},
{
type: "confirm",
name: "hasStarterClass",
message: "do you want a starter class?",
default: true,
},
{
type: "input",
name: "name",
message: "name in CamelCase:",
},
],
actions: [
{
type: "add",
path: "src/{{type}}s/{{name}}/{{name}}.tsx",
templateFile: "plop-templates/tsx.hbs",
},
{
type: "add",
path: "src/{{type}}s/{{name}}/{{name}}.css",
templateFile: "plop-templates/css.hbs",
},
],
});
}