mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-23 23:59:02 -06:00
feat: improve prompt flow
This commit is contained in:
@@ -169,7 +169,7 @@ module.exports = class Creator {
|
||||
} else {
|
||||
// manual
|
||||
options = {
|
||||
packageManager: answers.packageManager,
|
||||
packageManager: answers.packageManager || loadOptions().packageManager,
|
||||
plugins: {}
|
||||
}
|
||||
// run cb registered by prompt modules to finalize the options
|
||||
@@ -242,7 +242,8 @@ module.exports = class Creator {
|
||||
|
||||
resolveOutroPrompts () {
|
||||
const outroPrompts = []
|
||||
if (hasYarn) {
|
||||
const savedOptions = loadOptions()
|
||||
if (hasYarn && !savedOptions.packageManager) {
|
||||
outroPrompts.push({
|
||||
name: 'packageManager',
|
||||
when: isMode('manual'),
|
||||
@@ -266,7 +267,7 @@ module.exports = class Creator {
|
||||
name: 'save',
|
||||
when: isMode('manual'),
|
||||
type: 'confirm',
|
||||
message: 'Save the preferences for future projects?'
|
||||
message: 'Save the preferences for future projects? (You can always manually edit ~/.vuerc)'
|
||||
})
|
||||
return outroPrompts
|
||||
}
|
||||
|
||||
@@ -32,7 +32,10 @@ exports.defaults = {
|
||||
packageManager: hasYarn ? 'yarn' : 'npm',
|
||||
plugins: {
|
||||
'@vue/cli-plugin-babel': {},
|
||||
'@vue/cli-plugin-eslint': { config: 'base', lintOn: 'save' },
|
||||
'@vue/cli-plugin-eslint': {
|
||||
config: 'base',
|
||||
lintOn: ['save', 'commit']
|
||||
},
|
||||
'@vue/cli-plugin-unit-mocha': {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ module.exports = cli => {
|
||||
cli.injectFeature({
|
||||
name: 'Linter / Formatter',
|
||||
value: 'linter',
|
||||
short: 'Linter'
|
||||
short: 'Linter',
|
||||
checked: true
|
||||
})
|
||||
|
||||
cli.injectPrompt({
|
||||
@@ -48,11 +49,13 @@ module.exports = cli => {
|
||||
choices: [
|
||||
{
|
||||
name: 'Lint on save',
|
||||
value: 'save'
|
||||
value: 'save',
|
||||
checked: true
|
||||
},
|
||||
{
|
||||
name: 'Lint and fix on commit' + (hasGit ? '' : chalk.red(' (requires Git)')),
|
||||
value: 'commit'
|
||||
value: 'commit',
|
||||
checked: true
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
module.exports = cli => {
|
||||
cli.injectFeature({
|
||||
name: 'Progressive Web App (PWA) Support',
|
||||
value: 'pwa'
|
||||
value: 'pwa',
|
||||
short: 'PWA'
|
||||
})
|
||||
|
||||
cli.onPromptComplete((answers, options) => {
|
||||
|
||||
@@ -2,7 +2,8 @@ module.exports = cli => {
|
||||
cli.injectFeature({
|
||||
name: 'Unit Testing',
|
||||
value: 'unit',
|
||||
short: 'Unit'
|
||||
short: 'Unit',
|
||||
checked: true
|
||||
})
|
||||
|
||||
cli.injectPrompt({
|
||||
|
||||
Reference in New Issue
Block a user