JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 48527
  • Score
    100M100P100Q151433F
  • License MIT

Run jscodeshift on Vue single file components

Package Exports

  • vue-jscodeshift-adapter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-jscodeshift-adapter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vue-jscodeshift-adapter

Build Status Greenkeeper badge

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