-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ts
80 lines (77 loc) · 2.36 KB
/
config.ts
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
import { PlopTypes } from '@turbo/gen';
const CATEGORIES = [
'Form',
'Navigation',
'Feedback',
'Content',
'Status',
'Data',
'Overlay',
'Date & Time',
];
export default function generator(plop: PlopTypes.NodePlopAPI): void {
plop.setGenerator('dss-ui-component', {
description: 'Scaffolds a new UI Component',
prompts: [
{
type: 'input',
name: 'name',
message: 'What is the NAME of the component?',
},
{
type: 'list',
name: 'category',
message: 'What is the CATEGORY of the component?',
choices: CATEGORIES,
},
],
actions: [
// ui library
{
type: 'add',
path: 'packages/dss-ui/src/components/{{pascalCase name}}/{{pascalCase name}}.tsx',
templateFile: 'templates/ui-component-core.hbs',
},
{
type: 'add',
path: 'packages/dss-ui/src/components/{{pascalCase name}}/{{pascalCase name}}.css.ts',
templateFile: 'templates/ui-component-css.hbs',
},
{
type: 'add',
path: 'packages/dss-ui/src/components/{{pascalCase name}}/{{pascalCase name}}.stories.tsx',
templateFile: 'templates/ui-component-stories.hbs',
},
{
type: 'add',
path: 'packages/dss-ui/src/components/{{pascalCase name}}/{{pascalCase name}}.spec.tsx',
templateFile: 'templates/ui-component-spec.hbs',
},
{
type: 'add',
path: 'packages/dss-ui/src/components/{{pascalCase name}}/index.ts',
template:
"export { default as {{pascalCase name}} } from './{{pascalCase name}}';\n\n" +
"export type { {{pascalCase name}}Props } from './{{pascalCase name}}';",
},
{
type: 'append',
path: 'packages/dss-ui/src/components/index.ts',
template:
"export { {{pascalCase name}} } from './{{pascalCase name}}';\n\n" +
"export type { {{pascalCase name}}Props } from './{{pascalCase name}}';",
},
// documentation
{
type: 'add',
path: 'apps/docs/src/content/components/{{pascalCase name}}/index.mdx',
templateFile: 'templates/docs-component-examples.hbs',
},
{
type: 'add',
path: 'apps/docs/src/content/components/{{pascalCase name}}/usage.mdx',
templateFile: 'templates/docs-component-usage.hbs',
},
],
});
}