-
Notifications
You must be signed in to change notification settings - Fork 0
/
prompts.js
59 lines (58 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
58
59
const path = require('path')
module.exports = [
{
name: 'electronBuilder.electronVersion',
type: 'list',
message: 'Choose Electron Version',
default: '^32.0.0',
choices: [
{
name: '^29.0.0',
value: '^29.0.0',
short: '^29.0.0'
},
{
name: '^30.0.0',
value: '^30.0.0',
short: '^30.0.0'
},
{
name: '^31.0.0',
value: '^31.0.0',
short: '^31.0.0'
},
{
name: '^32.0.0',
value: '^32.0.0',
short: '^32.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 Playwright 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['@playwright/test'])
} catch (e) {
console.log('Unable to read package.json')
return false
}
}
}
]