You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Paul Salaets 7b3dd87a88
Merge pull request #21 from psalaets/dependabot/npm_and_yarn/ajv-6.12.6
9 months ago
src fix: Preserve indentation for script and style tags 2 years ago
tests fix: Preserve indentation for script and style tags 2 years ago
.gitignore initial commit 5 years ago
.travis.yml goodbye node 6, hello node 12 4 years ago
CHANGELOG.md make it a link 2 years ago
LICENSE.mit 2.1.0 3 years ago
README.md greenkeeper went offline, using dependabot for now 2 years ago
ideas.md add meta 5 years ago
package-lock.json Merge pull request #21 from psalaets/dependabot/npm_and_yarn/ajv-6.12.6 9 months ago
package.json 2.2.0 2 years ago

README.md

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
const adapt = require('vue-jscodeshift-adapter');
const someCodemod = require('some-codemod');

module.exports = 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