Skip to content

khanhduy1407/kdu-jscodeshift-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kdu-jscodeshift-adapter

Run jscodeshift on Kdu single file components

Install

npm install kdu-jscodeshift-adapter -D

Usage

The instructions below assume you're familiar with jscodeshift.

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

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

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

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

module.exports = adapt(someCodemod);

2. Run jscodeshift

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

See jscodeshift readme for more info on jscodeshift CLI.

License

MIT

About

Run jscodeshift on Kdu single file components

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published