forked from bencodezen/vue-enterprise-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prompt.js
45 lines (44 loc) · 1.01 KB
/
prompt.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
const _ = require('lodash')
module.exports = [
{
type: 'input',
name: 'name',
message: 'Name:',
validate(value) {
if (!value.length) {
return 'Components must have a name.'
}
const fileName = _.kebabCase(value)
if (fileName.indexOf('-') === -1) {
return 'Component names should contain at least two words to avoid conflicts with existing and future HTML elements.'
}
return true
},
},
{
type: 'multiselect',
name: 'blocks',
message: 'Blocks:',
initial: ['script', 'template', 'style'],
choices: [
{
name: 'script',
message: '<script>',
},
{
name: 'template',
message: '<template>',
},
{
name: 'style',
message: '<style>',
},
],
validate(value) {
if (value.indexOf('script') === -1 && value.indexOf('template') === -1) {
return 'Components require at least a <script> or <template> tag.'
}
return true
},
},
]