-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support prompts when invoking plugins
also add invoke prompts for eslint & typescript plugins
- Loading branch information
Showing
4 changed files
with
164 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// these prompts are used if the plugin is late-installed into an existing | ||
// project and invoked by `vue invoke`. | ||
|
||
const chalk = require('chalk') | ||
const { hasGit } = require('@vue/cli-shared-utils') | ||
|
||
module.exports = [ | ||
{ | ||
name: 'config', | ||
type: 'list', | ||
message: `Pick an ESLint config:`, | ||
choices: [ | ||
{ | ||
name: 'Error prevention only', | ||
value: 'base', | ||
short: 'Basic' | ||
}, | ||
{ | ||
name: 'Airbnb', | ||
value: 'airbnb', | ||
short: 'Airbnb' | ||
}, | ||
{ | ||
name: 'Standard', | ||
value: 'standard', | ||
short: 'Standard' | ||
}, | ||
{ | ||
name: 'Prettier', | ||
value: 'prettier', | ||
short: 'Prettier' | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'lintOn', | ||
type: 'checkbox', | ||
message: 'Pick additional lint features:', | ||
choices: [ | ||
{ | ||
name: 'Lint on save', | ||
value: 'save' | ||
}, | ||
{ | ||
name: 'Lint and fix on commit' + (hasGit() ? '' : chalk.red(' (requires Git)')), | ||
value: 'commit' | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// these prompts are used if the plugin is late-installed into an existing | ||
// project and invoked by `vue invoke`. | ||
|
||
const chalk = require('chalk') | ||
const { hasGit } = require('@vue/cli-shared-utils') | ||
|
||
module.exports = [ | ||
{ | ||
name: `classComponent`, | ||
type: `confirm`, | ||
message: `Use class-style component syntax?` | ||
}, | ||
process.env.VUE_CLI_EXPERIMENTAL ? { | ||
name: `experimentalCompileTsWithBabel`, | ||
type: `confirm`, | ||
message: `Compile TS with babel? ${chalk.yellow(`(experimental)`)}` | ||
} : { | ||
name: `useTsWithBabel`, | ||
type: `confirm`, | ||
message: `Use Babel alongside TypeScript for auto-detected polyfills?` | ||
}, | ||
{ | ||
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' | ||
}, | ||
{ | ||
name: 'Lint and fix on commit' + (hasGit() ? '' : chalk.red(' (requires Git)')), | ||
value: 'commit' | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters