🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

vue3-migrate

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-migrate

This is a command-line tool that utilizes ChatGPT to automatically refactor Vue.js code from version 2 to version 3.

1.2.4
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

npm version npm downloads NPM license donate GitHub Repo stars

Vue.js Code Migration Tool

logo

This is a command-line tool that utilizes ChatGPT to automatically refactor Vue.js code from version 2 to version 3. It helps developers migrate their code by transforming it to use Typescript with the Composition API.

Usage

Installation

npm install -g vue3-migrate

Refactor a Single Vue File

To refactor a single Vue file, use the convert command:

$ vue3-migrate convert <filename> [options]

Replace <filename> with the path to the Vue file you want to refactor.

Options

  • -t, --token <token>: Specify the GPT token (required)
  • -m, --model <model>: Specify the GPT model to use (default: gpt-3.5-turbo-16k, optional)
  • -p, --prompt <prompt>: Specify the path to the prompt file (optional)
  • -mt, --max_tokens <max_tokens>: The GPT max tokens (default: 4096, optional).
  • -r, --replace: replace exist refactor files.

see help: vue3-migrate convert -h

Refactor All Vue Files in a Directory

To refactor all Vue files in a directory, use the directory command:

$ vue3-migrate directory <directory> [options]

Replace <directory> with the path to the directory containing the Vue files you want to refactor.

Options

  • -t, --token <token>: Specify the GPT token (required)
  • -m, --model <model>: Specify the GPT model to use (default: gpt-3.5-turbo-16k, optional)
  • -p, --prompt <prompt>: Specify the path to the prompt file (optional)
  • -t, --timeout <timeout>: The timeout option allows you to specify the timeout duration in milliseconds between each refactoring request when using the directory command. It determines the waiting time before sending the next request to the OpenAI API (default: 20 seconds, optional).
  • -mt, --max_tokens <max_tokens>: The GPT max tokens (default: 4096, optional).
  • -r, --replace: replace exist refactor files.

see help: vue3-migrate convert -h

Examples

Refactor a single Vue file:

$ vue3-migrate convert /path/MyView.vue --token=sk-...

Refactor all Vue files in a directory:

$ vue3-migrate directory /path/src/components --token=sk-...

Configuration

Before running the tool, make sure to set up the following:

  • Obtain a GPT token from OpenAI. You can sign up for an API key at https://openai.com/.
  • Create a prompt text file (md for example, default: prompt.md) that contains the instructions for the refactoring process. This file should specify the rules and guidelines for the refactoring.

Notes

  • The tool uses the OpenAI GPT API for code refactoring. Make sure you have a valid API key and appropriate permissions.
  • It's recommended to review the refactored code manually to ensure correctness and make any necessary adjustments.

License

This project is licensed under the MIT License.

Keywords

vue

FAQs

Package last updated on 11 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts