File tree 1 file changed +39
-0
lines changed
packages/@vue/cli-service/generator 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ const { execa } = require ( '@vue/cli-shared-utils' )
2
+
1
3
module . exports = ( api , options ) => {
2
4
api . render ( './template' , {
3
5
doesCompile : api . hasPlugin ( 'babel' ) || api . hasPlugin ( 'typescript' )
@@ -54,6 +56,43 @@ module.exports = (api, options) => {
54
56
} )
55
57
}
56
58
59
+ // for v3 compatibility
60
+ if ( options . router && ! api . hasPlugin ( 'router' ) ) {
61
+ api . extendPackage ( {
62
+ devDependencies : {
63
+ '@vue/cli-plugin-router' : '^4.0.0'
64
+ }
65
+ } )
66
+
67
+ api . onCreateComplete ( ( ) => {
68
+ execa . sync ( 'vue' , [
69
+ 'invoke' ,
70
+ '@vue/cli-plugin-router' ,
71
+ `--historyMode=${ options . routerHistoryMode ? 'true' : '' } `
72
+ ] , {
73
+ cwd : api . resolve ( '.' )
74
+ } )
75
+ } )
76
+ }
77
+
78
+ // for v3 compatibility
79
+ if ( options . vuex && ! api . hasPlugin ( 'vuex' ) ) {
80
+ api . extendPackage ( {
81
+ devDependencies : {
82
+ '@vue/cli-plugin-vuex' : '^4.0.0'
83
+ }
84
+ } )
85
+
86
+ api . onCreateComplete ( ( ) => {
87
+ execa . sync ( 'vue' , [
88
+ 'invoke' ,
89
+ '@vue/cli-plugin-vuex'
90
+ ] , {
91
+ cwd : api . resolve ( '.' )
92
+ } )
93
+ } )
94
+ }
95
+
57
96
// additional tooling configurations
58
97
if ( options . configs ) {
59
98
api . extendPackage ( options . configs )
You can’t perform that action at this time.
0 commit comments