This repository has been archived by the owner on Feb 21, 2022. It is now read-only.
forked from winjs-dev/vue-preset
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathprompts.js
executable file
·216 lines (214 loc) · 4.56 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/**
*
* @authors liwb ([email protected])
* @date 2019-04-29 09:31
* @version $ IIFE
*/
const pcUI = [
{
name: 'Element UI',
value: 'element-ui'
},
{
name: 'ant-design-vue',
value: 'ant'
},
{
name: 'none',
value: 'none'
}
];
// 没有用vue3实现
const pcUI2 = [
...pcUI,
{
name: 'h_ui',
value: 'hui'
},
{
name: 'iView',
value: 'iview'
}
];
module.exports = [
{
type: 'text',
name: 'createProject',
message: `推荐使用更为快速的创建项目方式\n npm init @winner-fed/project\n 详见:https://github.com/cloud-templates/create-project`,
},
{
name: 'preset',
type: 'list',
message: 'Please pick a preset',
choices: [
{
name: 'Vue 2',
value: 'v2'
},
{
name: 'Vue 3',
value: 'v3'
},
{
name: 'miniprogram',
value: 'mini'
}
],
default: 'v2'
},
{
name: 'language',
type: 'list',
message: 'Choose whether your develop language is a JS or TS(default:JS)',
when: (answers) => answers.preset !== 'mini',
choices: [
{
name: 'JS',
value: 'js'
},
{
name: 'TS',
value: 'ts'
}
],
default: 'js'
},
{
name: 'build-tools',
type: 'confirm',
message: 'Whether you need to add the build tool Vite?',
when: (answers) => answers.preset === 'v2',
initial: true
},
{
name: 'application',
type: 'list',
message: 'Choose whether your app is a PC or a mobile(default:mobile)',
when: (answers) => answers.preset !== 'mini',
choices: [
{
name: 'PC',
value: 'pc'
},
{
name: 'mobile',
value: 'mobile'
},
{
name: 'H5离线包',
value: 'offline'
}
],
default: 'mobile'
},
{
name: 'offline-id',
type: 'input',
message: 'Fill in the offline package ID',
validate: function (val) {
return /^[0-9a-z]{4,8}$/.test(val)
? true
: '请输入4-8位的小写英文字母或数字,注意唯一性';
},
when: (answers) =>
answers.preset !== 'mini' && answers.application === 'offline',
default: '离线包 ID'
},
{
name: 'offline-name',
type: 'input',
message: 'Fill in the offline package name',
validate: function (val) {
return /^[\u4e00-\u9fa5a-zA-Z0-9]{1,10}$/.test(val)
? true
: '请输入1-10位的中英文字符或数字';
},
when: (answers) =>
answers.preset !== 'mini' && answers.application === 'offline',
default: '离线包中文描述'
},
{
name: 'ui-framework',
type: 'list',
message: 'Choice UI Framework(default:none)',
choices: (answers) => (answers.preset === 'v2' ? pcUI2 : pcUI),
when: (answers) =>
answers.preset !== 'mini' && answers.application === 'pc',
default: 'none'
},
{
name: 'layout-adapter',
type: 'list',
message: 'Choose a mobile layout adaptation plan(default:rem)',
when: (answers) => answers.preset !== 'mini' && answers.application !== 'pc',
choices: [
{
name: 'viewpoint',
value: 'vw'
},
{
name: 'rem',
value: 'rem'
}
],
default: 'rem'
},
{
name: 'mobile-ui-framework',
type: 'list',
message: 'Choice Mobile UI Framework(default:WinUI)',
choices: [
{
name: 'WinUI',
value: 'wui'
},
{
name: 'Vant',
value: 'vant'
}
],
when: (answers) =>
answers.preset !== 'mini' &&
(answers.application === 'mobile' || answers.application === 'offline'),
default: 'wui'
},
{
name: 'version-control',
type: 'list',
message: 'Choose the Version control tool(default:svn)?',
choices: [
{
name: 'SVN',
value: 'svn'
},
{
name: 'Git',
value: 'git'
}
],
default: 'svn'
},
{
name: 'mirror-source',
type: 'confirm',
message: 'Whether it is an internal project of the company?',
when: (answers) => answers.preset !== 'mini',
initial: true
},
{
name: 'see-package',
type: 'confirm',
message: 'Whether to support the generation of see platform publications?',
when: (answers) =>
answers.preset !== 'mini' && answers['mirror-source'] === true,
initial: true
},
{
name: 'needs-subsystem',
type: 'confirm',
message: 'Whether to support the subsystem?',
when: (answers) =>
answers.preset !== 'mini' && answers['mirror-source'] === true,
initial: true
}
];