forked from vuejs/vue-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompts.js
66 lines (63 loc) · 1.65 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
// these prompts are used if the plugin is late-installed into an existing
// project and invoked by `vue invoke`.
const { chalk, hasGit } = require('@vue/cli-shared-utils')
const prompts = module.exports = [
{
name: `classComponent`,
type: `confirm`,
message: `Use class-style component syntax?`,
default: true
},
{
name: `useTsWithBabel`,
type: `confirm`,
message: 'Use Babel alongside TypeScript (required for modern mode, auto-detected polyfills, transpiling JSX)?'
},
{
name: `lint`,
type: `confirm`,
message: `Use TSLint?`
},
{
name: `lintOn`,
type: `checkbox`,
when: answers => answers.lint,
message: `Pick lint features:`,
choices: [
{
name: 'Lint on save',
value: 'save',
checked: true
},
{
name: 'Lint and fix on commit' + (hasGit() ? '' : chalk.red(' (requires Git)')),
value: 'commit'
}
]
},
{
name: `convertJsToTs`,
type: `confirm`,
message: `Convert all .js files to .ts?`,
default: true
},
{
name: `allowJs`,
type: `confirm`,
message: `Allow .js files to be compiled?`,
default: false
},
{
name: 'skipLibCheck',
type: `confirm`,
message: `Skip type checking of all declaration files (recommended for apps)?`,
default: true
}
]
// in RC6+ the export can be function, but that would break invoke for RC5 and
// below, so this is a temporary compatibility hack until we release stable.
// TODO just export the function in 3.0.0
module.exports.getPrompts = pkg => {
prompts[2].when = () => !('@vue/cli-plugin-eslint' in (pkg.devDependencies || {}))
return prompts
}