Skip to content

Masa-Shin/define-component-converter

Repository files navigation

define-component-converter

Vue.extendを使っていたり何も使っていなかったりするsfcファイルを、defineComponent()を使うよう変換する

自分用に使うものなので、現状はlang="ts"が付いているファイルしか変換しません

🚀 Usage

$ npx define-component-converter run -- ./src/**/*.vue

Here is an example output:

 </template>
 
 <script lang="ts">
-import Vue from 'vue'
+import { defineComponent } from "@vue/composition-api"
 
-export default Vue.extend({
+export default defineComponent({
   name: 'AnimatedNumber',
   props: {

Note that the tool does not format the output itself. It is strongly recommended that you use it with some formatter.

📄 License

MIT.

About

VueのsfcファイルでdefineComponentを使うよう変換するCLIツール

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published