-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.js
55 lines (55 loc) · 1.69 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
module.exports = function (plop) {
// create your generators here
plop.setGenerator('Component', {
description: 'Create a stencil JS component',
prompts: [
{
type: 'input',
name: 'name',
message: 'Please specify the stencil component Name',
},
],
actions: [
// Add all the template files to the source folder
{
type: 'add',
path: 'src/components/\{{kebabCase name}}/\{{kebabCase name}}.tsx',
templateFile: 'plop/stencilTemplate/component.tsx',
},
{
type: 'add',
path: 'src/components/\{{kebabCase name}}/\{{kebabCase name}}.css',
templateFile: 'plop/stencilTemplate/component.css',
},
{
type: 'add',
path: 'src/components/\{{kebabCase name}}/\{{kebabCase name}}.e2e.ts',
templateFile: 'plop/stencilTemplate/component.e2e.ts',
},
{
type: 'modify',
path: 'src/components/\{{kebabCase name}}/\{{kebabCase name}}.tsx',
pattern: /template-component/g,
template: '\{{kebabCase name}}',
},
{
type: 'modify',
path: 'src/components/\{{kebabCase name}}/\{{kebabCase name}}.tsx',
pattern: /TemplateComponent/g,
template: '\{{pascalCase name}}',
},
{
type: 'modify',
path: 'src/components/\{{kebabCase name}}/\{{kebabCase name}}.e2e.ts',
pattern: /template-component/g,
template: '\{{kebabCase name}}',
},
{
type: 'modify',
path: 'src/components/\{{kebabCase name}}/\{{kebabCase name}}.css',
pattern: /template-component/g,
template: '\{{kebabCase name}}',
}
] // array of actions
});
};