-
-
Notifications
You must be signed in to change notification settings - Fork 278
/
prompts.js
57 lines (56 loc) · 1.38 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
const path = require('path')
module.exports = [
{
name: 'electronBuilder.electronVersion',
type: 'list',
message: 'Choose Electron Version',
default: '^13.0.0',
choices: [
{
name: '^11.0.0',
value: '^11.0.0',
short: '^11.0.0'
},
{
name: '^12.0.0',
value: '^12.0.0',
short: '^12.0.0'
},
{
name: '^13.0.0',
value: '^13.0.0',
short: '^13.0.0'
}
],
when: () => {
try {
// Attempt to read package.json
const pkg = require(path.join(process.cwd(), 'package.json'))
// Don't show if electron version is already set
return !pkg.devDependencies.electron
} catch (e) {
console.log('Unable to read package.json')
return true
}
}
},
{
name: 'electronBuilder.addTests',
type: 'confirm',
message: 'Add tests with Spectron to your project?',
when: () => {
try {
// Attempt to read package.json
const pkg = require(path.join(process.cwd(), 'package.json'))
// Don't show if electron version is already set
return (
pkg.devDependencies['@vue/cli-plugin-unit-jest'] ||
pkg.devDependencies['@vue/cli-plugin-unit-mocha']
)
} catch (e) {
console.log('Unable to read package.json')
return false
}
}
}
]