-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.js
59 lines (58 loc) · 1.52 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
56
57
58
59
export default function(plop) {
plop.setHelper('curly', (t) => `{${t}}`);
plop.setHelper('lowerCase', (t) => t.toLowerCase());
plop.setGenerator('theme', {
description: 'New theme starter generator',
prompts: [
{
type: 'input',
name: 'name',
message: 'Theme name (e.g. fancyname)',
},
],
actions: [
{
type: 'add',
path: 'src/{{name}}/components/index.ts',
templateFile: 'plop/theme/components/index.ts.hbs',
skipIfExists: true,
},
{
type: 'add',
path: 'src/{{name}}/foundations/colors.ts',
templateFile: 'plop/theme/foundations/colors.ts.hbs',
skipIfExists: true,
},
{
type: 'add',
path: 'src/{{name}}/config.ts',
templateFile: 'plop/theme/config.ts.hbs',
skipIfExists: true,
},
{
type: 'add',
path: 'src/{{name}}/index.ts',
templateFile: 'plop/theme/index.ts.hbs',
skipIfExists: true,
},
{
type: 'add',
path: 'src/{{name}}/styles.ts',
templateFile: 'plop/theme/styles.ts.hbs',
skipIfExists: true,
},
{
type: 'modify',
path: 'src/index.ts',
pattern: /\/\/ PLOP WILL APPEND NEW IMPORT HERE\n/gm,
templateFile: 'plop/modifyImport.hbs',
},
{
type: 'modify',
path: 'src/index.ts',
pattern: /^\s{2}\/\/ PLOP WILL APPEND NEW EXPORT HERE\n/gm,
templateFile: 'plop/modifyExport.hbs',
},
],
});
}