-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathplopfile.mjs
More file actions
101 lines (101 loc) · 2.94 KB
/
plopfile.mjs
File metadata and controls
101 lines (101 loc) · 2.94 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
export default function (plop) {
// component generator
plop.setGenerator('component', {
actions: [
{
path: 'packages-proprietary/tokens/src/components/ams/{{kebabCase name}}.tokens.json',
templateFile: 'plop-templates/tokens.json.hbs',
type: 'add',
},
{
path: 'packages/css/src/components/{{kebabCase name}}/{{kebabCase name}}.scss',
templateFile: 'plop-templates/style.scss.hbs',
type: 'add',
},
{
path: 'packages/css/src/components/{{kebabCase name}}/README.md',
templateFile: 'plop-templates/style.docs.md.hbs',
type: 'add',
},
{
path: 'packages/css/src/components/index.scss',
pattern: `/* Append here */`,
template: `@use "{{kebabCase name}}/{{kebabCase name}}";`,
type: 'append',
},
{
path: 'packages/react/src/{{pascalCase name}}/{{pascalCase name}}.tsx',
templateFile: 'plop-templates/react.tsx.hbs',
type: 'add',
},
{
path: 'packages/react/src/{{pascalCase name}}/{{pascalCase name}}.test.tsx',
templateFile: 'plop-templates/react.test.tsx.hbs',
type: 'add',
},
{
path: 'packages/react/src/{{pascalCase name}}/README.md',
templateFile: 'plop-templates/react.docs.md.hbs',
type: 'add',
},
{
path: 'packages/react/src/{{pascalCase name}}/index.ts',
templateFile: 'plop-templates/react.index.ts.hbs',
type: 'add',
},
{
path: 'packages/react/src/index.ts',
pattern: `/* Append here */`,
template: `export * from './{{pascalCase name}}'`,
type: 'append',
},
{
data: { curlyBefore: '{' },
path: 'storybook/src/components/{{pascalCase name}}/{{pascalCase name}}.docs.mdx',
templateFile: 'plop-templates/storybook.docs.mdx.hbs',
type: 'add',
},
{
path: 'storybook/src/components/{{pascalCase name}}/{{pascalCase name}}.stories.tsx',
templateFile: 'plop-templates/storybook.stories.tsx.hbs',
type: 'add',
},
{
path: 'storybook/src/components/{{pascalCase name}}/{{pascalCase name}}.test.stories.tsx',
templateFile: 'plop-templates/storybook.test.stories.tsx.hbs',
type: 'add',
},
],
description: 'scaffolding for new component',
prompts: [
{
message: "component's name",
name: 'name',
type: 'input',
},
{
default: 'span',
message: 'Tag name: ',
name: 'tag',
type: 'input',
},
{
default: 'HTMLAttributes',
message: 'DOM API Attributes: ',
name: 'attributes',
type: 'input',
},
{
default: 'HTMLElement',
message: 'DOM API Type: ',
name: 'type',
type: 'input',
},
{
message: 'Aria Role: ',
name: 'role',
type: 'input',
},
],
})
}