Migrate new Vue({...}).$mount() to createApp()

Proprietary

Vue 3 has no global Vue constructor. Rewrites new Vue({render: h => h(App)}).$mount('#app') and new Vue({el: '#app', render: h => h(App)}) to createApp(App).mount('#app'), installing the router and store options with .use(...) and moving the preceding top-level Vue.use, Vue.component, Vue.directive and Vue.mixin calls onto the app, as the Vue 3 global API migration guide maps them; Vue.use(VueRouter) and Vue.use(Vuex) are dropped, because Vue Router 4 and Vuex 4 are installed through the router and store options. Only an ES import Vue from 'vue' file with a single such new Vue is rewritten; a file that uses Vue in any other way (Vue.config, Vue.prototype, Vue.extend, other options such as data or template) is left as it is.

org.openrewrite.nodejs.migrate.vue.MigrateNewVueToCreateApp
mod run . --recipe=org.openrewrite.nodejs.migrate.vue.MigrateNewVueToCreateApp

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.