vue-jscodeshift-adapter

Run jscodeshift on Vue single file components

MIT 12 个版本
安装
npm install vue-jscodeshift-adapter
yarn add vue-jscodeshift-adapter
pnpm add vue-jscodeshift-adapter
bun add vue-jscodeshift-adapter
README

vue-jscodeshift-adapter

Build Status

Run jscodeshift on Vue single file components

Install

npm install vue-jscodeshift-adapter -D

Usage

The instructions below assume you're familiar with jscodeshift.

Run a codemod on some .js and/or .vue files

When transforming fileInfo.source will be
.js the contents of the file
.vue the contents of <script>

The source file will be updated appropriately based on the return value of your transform().

If .vue file doesn't have a <script>, your transform() will not be called and the source file will not be changed.

1. Create wrapped transform function

// my-transform.js
import adapt from 'vue-jscodeshift-adapter';
import someCodemod from 'some-codemod';

export default adapt(someCodemod);

2. Run jscodeshift

$ jscodeshift <path> -t my-transform.js --extensions vue,js

See jscodeshift readme for more info on jscodeshift CLI.

License

MIT

版本列表
3.0.0 2024-05-11
2.2.1 2023-10-12
2.2.0 2020-10-02
2.1.0 2020-05-16
2.0.3 2019-12-11
2.0.2 2019-05-23
2.0.1 2018-08-02
2.0.0 2018-03-25
1.2.0 2018-03-19
1.1.1 2018-03-14
1.1.0 2018-03-03
1.0.0 2018-02-25