-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.js
103 lines (101 loc) · 2.8 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
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
97
98
99
100
101
102
103
const config = (
/** @type {import('plop').NodePlopAPI} */
plop,
) => {
plop.setGenerator('Mother File Generator', {
description: 'To be used to create a component or a container',
prompts: [
{
type: 'list',
name: 'folderType',
message: 'What would you like to create?',
choices: ['containers', 'components'],
},
{
type: 'input',
name: 'folderName',
message: 'Name of the folder: ',
},
{
type: 'confirm',
name: 'memoize',
message: 'Do you want to memoize your React Node?',
default: true,
}
],
// actions: [
// {
// type: 'add',
// path: 'src/components/{{folderName}}/index.tsx',
// templateFile: 'plop-templates/index.hbs',
// },
// {
// type: '',
// path: 'src/components/{{folderName}}/styles.ts',
// templateFile: 'plop-templates/styles.hbs',
// },
// ],
// actions: (data) => {
// let actions = [];
// if (data.folderType === 'Container')
// actions.push({
// type: 'add',
// path: `src/containers/{{pascalCase folderName}}/index.tsx`,
// templateFile: 'plop-templates/index.hbs',
// });
// else {
// actions.push({
// type: 'add',
// path: `src/components/{{pascalCase folderName}}/index.tsx`,
// templateFile: 'plop-templates/index.hbs',
// });
// }
// if (data.requireStyles) {
// actions.push({
// type: 'add',
// path: `src/components/{{pascalCase folderName}}/index.tsx`,
// templateFile: 'plop-templates/index.hbs',
// });
// }
// },
actions: (data) => {
let actions = [];
actions.push(
{
type: 'add',
path: `src/{{folderType}}/{{pascalCase folderName}}/index.tsx`,
templateFile: 'plop-templates/index.hbs',
},
{
type: 'add',
path: `src/{{folderType}}/{{pascalCase folderName}}/styles.ts`,
templateFile: 'plop-templates/styles.hbs',
},
);
return actions;
}
});
// plop.setGenerator('Container', {
// description: 'Generating Container',
// prompts: [
// {
// type: 'input',
// name: 'folderName',
// message: 'What is the name of your container?',
// },
// ],
// actions: [
// {
// type: 'add',
// path: 'src/containers/{{folderName}}/index.tsx',
// templateFile: 'plop-templates/index.hbs',
// },
// {
// type: 'add',
// path: 'src/containers/{{folderName}}/styles.ts',
// templateFile: 'plop-templates/styles.hbs',
// },
// ],
// });
};
module.exports = config;