Giter VIP home page Giter VIP logo

vue-class-migrator's Introduction

CI

npm npm

Vue Class Migrator CLI

Vue Class Migrator is a utility designed to facilitate the migration of Vue and TypeScript files using the @component decorator from vue-class-components to the defineComponent format. Under the hood, it employs ts-morph for parsing and generating files.

Installation

You can install vue-class-migrator globally using npm:

npm install -g vue-class-migrator

How to use the tool

Accepted options

  • -d: Specifies the directory you want to migrate.
  • --sfc: (Optional flag, default: false) Removes original TS and style files, generating a final Vue Single File Component (SFC).
npm run migrate -- -d <your_path>

Considerations

The tool also migrates decorators from vuex-class and vue-property-decorator.

If the tool encounters unsupported code in your class, it will produce errors. Monitor the output and verify the generated file. In such cases, you can contribute to the migrator to add support or correct the file manually.

Migration workflow recommendation

Initially, avoid using --sfc directly.

First, run the tool without it and compare the changes in the TS files using version control. If satisfied, discard the changes and rerun with --sfc.

Compatibility note

In addition to migrating the class to the defineComponent format, vue-class-migrator also migrates the following libraries out of the box.

vuex-class

Decorator Support
@State ❌ Not yet
@Getter
@namespace.Getter ❌ Not yet
@Action
@Mutation

vue-property-decorator

Decorator Support
@Prop
@PropSync
@Model
@ModelSync
@Watch
@Provide ❌ Not yet
@Inject ❌ Not yet
@ProvideReactive ❌ Not yet
@InjectReactive ❌ Not yet
@Emit ❌ Not yet
@Ref
@VModel ❌ Not yet
@Component
@Mixins

Security

For security matters please contact [email protected].

Legal

Copyright 2023 GetYourGuide GmbH.

vue-class-migrator is licensed under the Apache License, Version 2.0. See LICENSE for the full text.

vue-class-migrator's People

Contributors

victorcuena avatar philippsieber avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.