@@ -111,6 +111,16 @@ module.exports = class Creator extends EventEmitter {
111
111
}
112
112
}
113
113
114
+ // Introducing this hack because typescript plugin must be invoked after router.
115
+ // Currently we rely on the `plugins` object enumeration order,
116
+ // which depends on the order of the field initialization.
117
+ // FIXME: Remove this ugly hack after the plugin ordering API settled down
118
+ if ( preset . plugins [ '@vue/cli-plugin-router' ] && preset . plugins [ '@vue/cli-plugin-typescript' ] ) {
119
+ const tmp = preset . plugins [ '@vue/cli-plugin-typescript' ]
120
+ delete preset . plugins [ '@vue/cli-plugin-typescript' ]
121
+ preset . plugins [ '@vue/cli-plugin-typescript' ] = tmp
122
+ }
123
+
114
124
// legacy support for vuex
115
125
if ( preset . vuex ) {
116
126
preset . plugins [ '@vue/cli-plugin-vuex' ] = { }
@@ -423,7 +433,6 @@ module.exports = class Creator extends EventEmitter {
423
433
]
424
434
}
425
435
const vueVersionPrompt = {
426
- when : answers => answers . preset === 'default' ,
427
436
name : 'vueVersion' ,
428
437
type : 'list' ,
429
438
message : `Choose a version of Vue.js that you want to start the project with` ,
@@ -532,10 +541,20 @@ module.exports = class Creator extends EventEmitter {
532
541
return isManualMode ( answers ) && originalWhen ( answers )
533
542
}
534
543
} )
544
+
545
+ const vueVersionPromptForDefaultPreset = Object . assign ( {
546
+ when : answers => answers . preset === 'default'
547
+ } , this . vueVersionPrompt )
548
+
549
+ const vueVersionPromptAsAFeature = Object . assign ( {
550
+ when : answers => answers . features . includes [ 'vueVersion' ]
551
+ } , this . vueVersionPrompt )
552
+
535
553
const prompts = [
536
554
this . presetPrompt ,
537
- this . vueVersionPrompt ,
555
+ vueVersionPromptForDefaultPreset ,
538
556
this . featurePrompt ,
557
+ vueVersionPromptAsAFeature ,
539
558
...this . injectedPrompts ,
540
559
...this . outroPrompts
541
560
]
0 commit comments