UNPKG

1.69 kBJavaScriptView Raw
1// these prompts are used if the plugin is late-installed into an existing
2// project and invoked by `vue invoke`.
3
4const { chalk, hasGit } = require('@vue/cli-shared-utils')
5
6const prompts = module.exports = [
7 {
8 name: `classComponent`,
9 type: `confirm`,
10 message: `Use class-style component syntax?`,
11 default: true
12 },
13 {
14 name: `useTsWithBabel`,
15 type: `confirm`,
16 message: 'Use Babel alongside TypeScript (required for modern mode, auto-detected polyfills, transpiling JSX)?'
17 },
18 {
19 name: `lint`,
20 type: `confirm`,
21 message: `Use TSLint?`
22 },
23 {
24 name: `lintOn`,
25 type: `checkbox`,
26 when: answers => answers.lint,
27 message: `Pick lint features:`,
28 choices: [
29 {
30 name: 'Lint on save',
31 value: 'save',
32 checked: true
33 },
34 {
35 name: 'Lint and fix on commit' + (hasGit() ? '' : chalk.red(' (requires Git)')),
36 value: 'commit'
37 }
38 ]
39 },
40 {
41 name: `convertJsToTs`,
42 type: `confirm`,
43 message: `Convert all .js files to .ts?`,
44 default: true
45 },
46 {
47 name: `allowJs`,
48 type: `confirm`,
49 message: `Allow .js files to be compiled?`,
50 default: false
51 },
52 {
53 name: 'skipLibCheck',
54 type: `confirm`,
55 message: `Skip type checking of all declaration files (recommended for apps)?`,
56 default: true
57 }
58]
59
60// in RC6+ the export can be function, but that would break invoke for RC5 and
61// below, so this is a temporary compatibility hack until we release stable.
62// TODO just export the function in 3.0.0
63module.exports.getPrompts = pkg => {
64 prompts[2].when = () => !('@vue/cli-plugin-eslint' in (pkg.devDependencies || {}))
65 return prompts
66}