@@ -13,5 +13,49 @@ module.exports = (api) => {
13
13
prune :true
14
14
} )
15
15
16
+ if ( api . hasPlugin ( 'vuex' ) || api . generator . pkg . dependencies [ 'vuex' ] ) {
17
+ api . extendPackage ( {
18
+ dependencies :{
19
+ vuex :'^4.0.0-alpha.1'
20
+ }
21
+ } )
22
+
23
+ api . exitLog ( 'Installed vuex 4.0.' )
24
+ api . exitLog ( 'Codemod not yet implemented, please follow the documentation at https://github.com/vuejs/vuex/tree/4.0' )
25
+
26
+ // Codemod TODOs:
27
+ // * Remove `Vue.use(Vuex)`
28
+ // * `new Vue({ store })` -> `app.use(store)`
29
+ // * optional: `new Vuex.Store({})` -> `createStore({})`
30
+ }
31
+
32
+ if ( api . hasPlugin ( 'router' ) || api . generator . pkg . dependencies [ 'router' ] ) {
33
+ api . extendPackage ( {
34
+ dependencies :{
35
+ 'vue-router' :'^4.0.0-alpha.3'
36
+ }
37
+ } )
38
+
39
+ api . exitLog ( 'Installed vue-router 4.0.' )
40
+ api . exitLog ( 'Codemod not yet implemented, please follow the documentation at https://github.com/vuejs/vue-router-next' )
41
+
42
+ // Codemod TODOs:
43
+ // * Remove `Vue.use(VueRouter)`
44
+ // * `new VueRouter({})` -> `createRouter({})`
45
+ // * `mode`:
46
+ // * `mode: 'history'` -> `history: createWebHistory()`
47
+ // * `mode: 'hash'` -> `history: createWebHashHistory()`
48
+ // * `mode: 'abstract'` -> `history: createMemoryHistory()`
49
+ // * `new Vue({ router })` -> `app.use(router)`
50
+ // * Async component syntax migration as described in RFC0007
51
+ // * Create the corresponding imports
52
+ // * Remove unused imports (use ESLint for this task)
53
+
54
+ // Others:
55
+ // * Catch all routes (`/*`) must now be defined using a parameter with a custom regex: `/:catchAll(.*)`
56
+ // * `keep-alive` is not yet supported
57
+ // * Partial support of per-component navigation guards. No `beforeRouteEnter`
58
+ }
59
+
16
60
api . transformScript ( api . entryFile , require ( './codemods/rfc09-global-api' ) )
17
61
}