-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.js
64 lines (64 loc) · 2.04 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
module.exports = (plop) => {
plop.setGenerator("component", {
description: "Main plopfile",
prompts: [
{
type: "list",
name: "componentType",
message: "Type of the Component",
choices: ["components", "pages"],
},
{
type: "input",
name: "componentName",
message: "Name of the Component",
},
],
actions: [
{
type: "add",
path: "src/{{componentType}}/{{pascalCase componentName}}/{{pascalCase componentName}}.scss",
templateFile: "plop_templates/components/component.scss.hbs",
},
{
type: "add",
path: "src/{{componentType}}/{{pascalCase componentName}}/{{pascalCase componentName}}.types.ts",
templateFile: "plop_templates/components/component.types.hbs",
},
{
type: "add",
path: "src/{{componentType}}/{{pascalCase componentName}}/{{pascalCase componentName}}.tsx",
templateFile: "plop_templates/components/component.hbs",
},
{
type: "add",
path: "src/{{componentType}}/{{pascalCase componentName}}/index.ts",
templateFile: "plop_templates/components/index.hbs",
},
{
type: "add",
path: "src/{{componentType}}/{{pascalCase componentName}}/__test__/{{pascalCase componentName}}.test.tsx",
templateFile: "plop_templates/components/component.test.hbs",
},
{
type: "append",
path: "src/styles/main.scss",
pattern: "/* PLOP_INJECT_IMPORT */",
template:
"@import '../{{componentType}}/{{pascalCase componentName}}/{{pascalCase componentName}}.scss';",
},
{
type: "append",
path: "src/styles/theme/colors.scss",
pattern: "/* PLOP_INJECT_IMPORT */",
template: ".sa-{{kebabCase componentName}}{\n}\n",
},
{
type: "append",
path: "src/{{componentType}}/index.ts",
pattern: "/* PLOP_INJECT_IMPORT */",
template: 'export * from "./{{pascalCase componentName}}";',
},
],
});
};