forked from m0dch3n/vue-cli-plugin-cordova
/
prompts.js
58 lines (55 loc) · 1.29 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
const hasbin = require('hasbin')
const defaults = require('./defaults')
const hasCordova = hasbin.sync('cordova')
const cordovaBinaryMissing = {
name: 'cordovaDeppendency',
type: 'string',
message: 'Unable to find cordova binary, make sure it\'s installed.',
default: 'Quit'
}
const prompts = [
{
name: 'cordovaPath',
type: 'string',
message: 'Name of folder where cordova should be installed',
default: defaults.cordovaPath,
validate: opt => opt && opt.length >= 0
},
{
name: 'id',
type: 'string',
message: 'ID of the app',
default: defaults.id,
validate: opt => opt && opt.length >= 0
},
{
name: 'appName',
type: 'string',
message: 'Name of the app',
default: defaults.appName,
validate: opt => opt && opt.length >= 0
},
{
name: 'platforms',
type: 'checkbox',
message: 'Select Platforms:',
choices: [
{
name: 'Android',
value: 'android',
checked: !!defaults.platforms['android']
},
{
name: 'iOS',
value: 'ios',
checked: !!defaults.platforms['ios']
},
{
name: 'Browser',
value: 'browser',
checked: !!defaults.platforms['browser']
}
]
}
]
module.exports = !hasCordova ? cordovaBinaryMissing : prompts