-
Notifications
You must be signed in to change notification settings - Fork 1
/
plopfile.mjs
47 lines (47 loc) · 1.36 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
export default function (plop) {
plop.setGenerator('component', {
description: 'Create a new component',
prompts: [
{
// Select the package for your Component
type: 'list',
name: 'packageName',
message: 'What is the package name of your component?',
choices: ['essentials', 'media-content', 'seo', 'services', 'widgets']
},
{
// Name your Component
type: 'input',
name: 'name',
message: 'What is the name of your component?'
}
],
actions: [
{
// Create the component files
type: 'addMany',
destination: './packages/{{packageName}}/src/lib/components/{{lowerCase name}}',
base: `.templates/component/definition`,
templateFiles: `.templates/component/definition/*.hbs`
},
{
// Export component in lib/index.ts
type: 'append',
path: './packages/{{packageName}}/src/lib/index.ts',
templateFile: '.templates/component/lib-index.ts.hbs'
},
{
// Create a test suite for the component
type: 'add',
path: './packages/{{packageName}}/tests/{{properCase name}}.spec.ts',
templateFile: '.templates/component/tests/test.spec.ts.hbs'
},
{
// Create a demo page route for the component
type: 'add',
path: './packages/{{packageName}}/src/routes/demos/{{lowerCase name}}/+page.svelte',
templateFile: '.templates/component/demo/page.svelte.hbs'
}
]
});
}