-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.js
43 lines (42 loc) · 1.01 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
export default function (plop) {
// create your generators here
plop.setGenerator("components", {
description: "React component using Typescript",
prompts: [
{
type: "input",
name: "name",
message: "Name: ",
},
{
type: "list",
name: "category",
message: "Which category type do you need?",
choices: ["atoms", "molecules", "organisms", "charts"],
},
{
type: "input",
name: "tag",
message: "Tag name: ",
},
],
actions: [
{
type: "addMany",
destination: "src/components/{{category}}/{{upperCamel name}}",
templateFiles: "plop_templates/component/**/*.hbs",
base: "plop_templates/component",
},
],
});
plop.setHelper("upperCamel", (txt) =>
txt
.split(" ")
.map((word) =>
Array.from(word)
.map((char, idx) => (idx === 0 ? char.toUpperCase() : char.toLowerCase()))
.join(""),
)
.join(""),
);
}