File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
packages/@vue/cli-service/generator Expand file tree Collapse file tree 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+
13module . exports = ( api , options ) => {
24 api . render ( './template' , {
35 doesCompile : api . hasPlugin ( 'babel' ) || api . hasPlugin ( 'typescript' )
@@ -54,6 +56,43 @@ module.exports = (api, options) => {
5456 } )
5557 }
5658
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+
5796 // additional tooling configurations
5897 if ( options . configs ) {
5998 api . extendPackage ( options . configs )
You can’t perform that action at this time.
0 commit comments