-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.cjs
96 lines (87 loc) · 2.34 KB
/
plopfile.cjs
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
const addInput = (name, message, type = 'HTMLDivElement', other) => {
return {type, name, message, ...other};
};
module.exports = function (plop) {
plop.setGenerator('component', {
description: 'React Component using Typescript',
prompts: [
addInput('name', 'Component Name: ')
],
actions: [{
type: 'addMany',
destination: 'src/components/{{name}}',
templateFiles: 'plop_templates/component/*.hbs',
base: 'plop_templates/component',
},]
});
plop.setGenerator('layout', {
description: 'React Layout using Typescript',
prompts: [
addInput('name', 'Component Name: ')
],
actions: [{
type: 'addMany',
destination: 'src/layouts/{{name}}',
templateFiles: 'plop_templates/layout/*.hbs',
base: 'plop_templates/layout',
},]
});
plop.setGenerator('page', {
description: 'React Page using Typescript',
prompts: [
addInput('name', 'Page Name: ')
],
actions: [{
type: 'addMany',
destination: 'src/pages/{{name}}',
templateFiles: 'plop_templates/page/*.hbs',
base: 'plop_templates/page',
},]
});
plop.setGenerator('context', {
description: 'React Context using Typescript',
prompts: [
addInput('name', 'Context Name: ')
],
actions: [{
type: 'addMany',
destination: 'src/contexts/{{name}}',
templateFiles: 'plop_templates/context/*.hbs',
base: 'plop_templates/context',
},]
});
plop.setGenerator('hook', {
description: 'React Hook using Typescript',
prompts: [
addInput('name', 'Hook Name: ')
],
actions: [{
type: 'addMany',
destination: 'src/hooks/{{name}}',
templateFiles: 'plop_templates/hook/*.hbs',
base: 'plop_templates/hook',
},]
});
plop.setGenerator('service', {
description: 'React Server using Typescript',
prompts: [
addInput('name', 'Service Name: ')
],
actions: [{
type: 'add',
path: 'src/services/{{snakeCase name}}.tsx',
templateFile: 'plop_templates/service.tsx.hbs',
},]
});
plop.setGenerator('utils', {
description: 'React Utils using Typescript',
prompts: [
addInput('name', 'Utils Name: ')
],
actions: [{
type: 'add',
path: 'src/utils/{{snakeCase name}}.tsx',
templateFile: 'plop_templates/utils.tsx.hbs',
},]
});
};