Skip to content

Commit 06af371

Browse files
committed
feat: improve prompt flow
1 parent 132b0db commit 06af371

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

packages/@vue/cli/lib/Creator.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ module.exports = class Creator {
169169
} else {
170170
// manual
171171
options = {
172-
packageManager: answers.packageManager,
172+
packageManager: answers.packageManager || loadOptions().packageManager,
173173
plugins: {}
174174
}
175175
// run cb registered by prompt modules to finalize the options
@@ -242,7 +242,8 @@ module.exports = class Creator {
242242

243243
resolveOutroPrompts () {
244244
const outroPrompts = []
245-
if (hasYarn) {
245+
const savedOptions = loadOptions()
246+
if (hasYarn && !savedOptions.packageManager) {
246247
outroPrompts.push({
247248
name: 'packageManager',
248249
when: isMode('manual'),
@@ -266,7 +267,7 @@ module.exports = class Creator {
266267
name: 'save',
267268
when: isMode('manual'),
268269
type: 'confirm',
269-
message: 'Save the preferences for future projects?'
270+
message: 'Save the preferences for future projects? (You can always manually edit ~/.vuerc)'
270271
})
271272
return outroPrompts
272273
}

packages/@vue/cli/lib/options.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ exports.defaults = {
3232
packageManager: hasYarn ? 'yarn' : 'npm',
3333
plugins: {
3434
'@vue/cli-plugin-babel': {},
35-
'@vue/cli-plugin-eslint': { config: 'base', lintOn: 'save' },
35+
'@vue/cli-plugin-eslint': {
36+
config: 'base',
37+
lintOn: ['save', 'commit']
38+
},
3639
'@vue/cli-plugin-unit-mocha': {}
3740
}
3841
}

packages/@vue/cli/lib/promptModules/linter.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module.exports = cli => {
55
cli.injectFeature({
66
name: 'Linter / Formatter',
77
value: 'linter',
8-
short: 'Linter'
8+
short: 'Linter',
9+
checked: true
910
})
1011

1112
cli.injectPrompt({
@@ -48,11 +49,13 @@ module.exports = cli => {
4849
choices: [
4950
{
5051
name: 'Lint on save',
51-
value: 'save'
52+
value: 'save',
53+
checked: true
5254
},
5355
{
5456
name: 'Lint and fix on commit' + (hasGit ? '' : chalk.red(' (requires Git)')),
55-
value: 'commit'
57+
value: 'commit',
58+
checked: true
5659
}
5760
]
5861
})

packages/@vue/cli/lib/promptModules/pwa.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module.exports = cli => {
22
cli.injectFeature({
33
name: 'Progressive Web App (PWA) Support',
4-
value: 'pwa'
4+
value: 'pwa',
5+
short: 'PWA'
56
})
67

78
cli.onPromptComplete((answers, options) => {

packages/@vue/cli/lib/promptModules/unit.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ module.exports = cli => {
22
cli.injectFeature({
33
name: 'Unit Testing',
44
value: 'unit',
5-
short: 'Unit'
5+
short: 'Unit',
6+
checked: true
67
})
78

89
cli.injectPrompt({

0 commit comments

Comments
 (0)