-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplopfile.js
50 lines (49 loc) · 1.02 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
const path = require('path');
module.exports = function(plop) {
// controller generator
plop.setGenerator('List', {
description: '生成列表页',
prompts: [
{
type: 'input',
name: 'path',
message: '路径(root: src/pages)',
default: '',
},
{
type: 'input',
name: 'name',
message: '文件名',
},
{
type: 'input',
name: 'fetch',
message: '列表请求地址',
},
],
actions: [
{
type: 'add',
path: path.join(__dirname, 'src/pages', '{{path}}/{{name}}.tsx'),
templateFile: 'template/List.hbs',
},
],
});
plop.setGenerator('Info', {
description: '生成详情页',
prompts: [
{
type: 'input',
name: 'name',
message: '文件名',
},
],
actions: [
{
type: 'add',
path: path.join(__dirname, 'src/pages', '{{path}}/{{name}}.tsx'),
templateFile: 'template/Info.hbs',
},
],
});
};