-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprompts.js
100 lines (98 loc) · 2.09 KB
/
prompts.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
/*
* @Author: qinyang
* @Date: 2018-07-21 22:15:42
* @Last Modified by: qile
* @Last Modified time: 2019-11-27 22:13:46
*/
const path = require('path')
// function showWhenInit(answers) {
// if (answers.presetCodeList.includes('init')) {
// return true
// }
// return false
// }
module.exports = [
{
type: 'checkbox',
// 需要预置哪些代码块
name: 'presetCodeList',
message: '请选择需要预置的代码块',
default: ['init', 'constants', 'services', 'devAccountSel'],
choices: [
{
name: '初始化配置',
value: 'init',
},
{
name: 'constants',
value: 'constants',
},
{
name: 'services',
value: 'services',
},
// 账号服务器选择功能
{
name: 'devAccountSel',
value: 'devAccountSel',
},
{
name: 'rishiqingSingleSpa',
value: 'rishiqingSingleSpa',
},
{
name: 'simditor style',
value: 'simditor',
},
{
name: 'sprites',
value: 'sprites',
},
{
name: 'xss',
value: 'xss',
},
{
name: 'i18n',
value: 'i18n',
},
],
}, {
type: 'input',
name: 'domainName',
message: 'CDN域名',
default: 'res-front-cdn.timetask.cn',
// eslint-disable-next-line arrow-body-style
filter: (input) => {
return input
},
// when: showWhenInit,
}, {
type: 'input',
name: 'baseUrl',
message: '设置项目地址前缀',
default: 'test',
// eslint-disable-next-line arrow-body-style
filter: (input) => {
return path.posix.join('/', input, '/')
},
// when: showWhenInit,
}, {
type: 'input',
name: 'port',
message: '设置项目调试端口',
default: 3001,
validate: (input) => {
const p = Number(input)
if (Number.isNaN(p)) {
return '需要输入正整数'
}
return true
},
// eslint-disable-next-line arrow-body-style
filter: (input) => {
return Number(input)
},
// when: showWhenInit,
},
]