-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathplopfile.mjs
96 lines (96 loc) · 2.73 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
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
export default function (plop) {
// component generator
plop.setGenerator('component', {
description: 'scaffolding for new component',
prompts: [
{
type: 'input',
name: 'name',
message: "component's name",
},
{
type: 'input',
name: 'tag',
message: 'Tag name: ',
default: 'span',
},
{
type: 'input',
name: 'attributes',
message: 'DOM API Attributes: ',
default: 'HTMLAttributes',
},
{
type: 'input',
name: 'type',
message: 'DOM API Type: ',
default: 'HTMLElement',
},
{
type: 'input',
name: 'role',
message: 'Aria Role: ',
},
],
actions: [
{
type: 'add',
path: '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: 'append',
path: 'packages/css/src/components/index.scss',
pattern: `/* Append here */`,
template: `@use "./{{kebabCase name}}/{{kebabCase name}}";`,
},
{
type: 'add',
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: 'append',
path: 'packages/react/src/index.ts',
pattern: `/* Append here */`,
template: `export * from './{{pascalCase name}}'`,
},
{
type: 'add',
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',
},
],
})
}