This repository was archived by the owner on Apr 27, 2020. It is now read-only.
forked from DuYongLee/react-generate-component
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.js
More file actions
64 lines (57 loc) · 1.64 KB
/
config.js
File metadata and controls
64 lines (57 loc) · 1.64 KB
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
const Case = require('case');
module.exports = {
output: './src',
filenames: {
index: 'index.js',
main: '[name].js',
style: '[name].scss',
test: '[name].spec.js'
},
templates: {
main(name) {
return (`
import React from 'react';
const ${name} = ({children}) => (
<div className="${Case.kebab(name)}">
{children}
</div>
);
export default ${name};
`);
},
style(name) {
return (`
// ------------------------------------- //
// Style of ${name}
// ------------------------------------- //
$module: '${Case.kebab(name)}';
.#{$module} {
// ...
}
`);
},
test(name) {
return (`
import React from 'react';
import ${name} from './${name}';
describe('Test of ${name}', () => {
it('Test case 1.', () => {
// Given
// When
// Then
});
});
`);
},
index(name) {
return (`
import ${name} from './${name}';
export default ${name};
`);
}
},
hookscripts : {
pre(names, config) {},
post(names, config, result) {}
}
};