-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeta.js
64 lines (63 loc) · 1.89 KB
/
meta.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
module.exports = {
// 编译完成的消息
completeMessage: "{{#inPlace}}To get started:\n\n npm install\n npm run dev.{{else}}To get started:\n\n cd {{destDirName}}\n npm install\n npm run dev.{{/inPlace}}",
// 编译完成的回调
complete(data, {
logger,
chalk,
files
}) {
// can access data.inPlace, data.destDirName
logger.log(chalk.green('恭喜,项目初始化完毕!'))
},
// 忽略渲染的文件 glob pattern
skipInterpolation: "mvc/**/*",
// 过滤: test 目录只在用户 prompt 交互时选择了 needTests 才生成。
filters: {
"test/**/*": "test"
},
// handlerbar 的自定义 helper. 两个常用 Handlebars helpers已经内置: if_eq 和 unless_eq (常用来判断prompt答案)
helpers: {
lowercase: str => str.toLowerCase()
},
// 参考 https://github.com/SBoudrias/Inquirer.js/
prompts: {
"name": {
type: 'string',
required: true,
message: '请输入一个项目名称'
},
"desc": {
type: 'string',
required: false,
message: '项目描述',
default: ''
},
"test": {
"type": "confirm",
"message": "是否开启单元测试?"
},
"mvc": {
"type": "checkbox",
"message": "需要哪些模块?",
"choices": [
{
name: 'controller',
default: true,
},
"model",
"view"
]
}
// "lintConfig": {
// "when": "test",
// "type": "list",
// "message": "Pick a lint config",
// "choices": [
// "standard",
// "airbnb",
// "none"
// ]
// }
}
}