-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
plopfile.js
75 lines (73 loc) · 1.9 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
69
70
71
72
73
74
75
module.exports = function (plop) {
plop.setGenerator("component", {
description: "New reusable component",
prompts: [
{
type: "input",
name: "name",
message: "Enter your component name:",
},
],
actions: [
{
type: "add",
path: "../src/components/{{pascalCase name}}/{{pascalCase name}}.tsx",
templateFile: "templates/component/component.tsx.hbs",
},
{
type: "add",
path: "../src/components/{{pascalCase name}}/index.ts",
templateFile: "templates/component/index.ts.hbs",
},
{
type: "add",
path: "../src/components/{{pascalCase name}}/{{pascalCase name}}.stories.tsx",
templateFile: "templates/component/stories.tsx.hbs",
},
],
});
plop.setGenerator("form", {
description: "New reusable form",
prompts: [
{
type: "input",
name: "name",
message: "Enter your form name:",
},
],
actions: [
{
type: "add",
path: "../src/components/forms/{{pascalCase name}}Form/{{pascalCase name}}Form.tsx",
templateFile: "templates/form/component.tsx.hbs",
},
{
type: "add",
path: "../src/components/forms/{{pascalCase name}}Form/index.ts",
templateFile: "templates/form/index.ts.hbs",
},
{
type: "add",
path: "../src/components/forms/{{pascalCase name}}Form/schema.ts",
templateFile: "templates/form/schema.ts.hbs",
},
],
});
plop.setGenerator("page", {
description: "New page with layout",
prompts: [
{
type: "input",
name: "name",
message: "Enter your page name (which will also be the url):",
},
],
actions: [
{
type: "add",
path: "../src/pages/{{kebabCase name}}.tsx",
templateFile: "templates/page/component.tsx.hbs",
},
],
});
};