Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/psalaets/vue-jscodeshift-adapter
Run jscodeshift on Vue single file components
https://github.com/psalaets/vue-jscodeshift-adapter
Last synced: 2 months ago
JSON representation
Run jscodeshift on Vue single file components
- Host: GitHub
- URL: https://github.com/psalaets/vue-jscodeshift-adapter
- Owner: psalaets
- License: mit
- Created: 2018-02-25T06:05:36.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-11T02:21:45.000Z (8 months ago)
- Last Synced: 2024-10-27T22:12:24.353Z (3 months ago)
- Language: JavaScript
- Size: 418 KB
- Stars: 26
- Watchers: 1
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.mit
Awesome Lists containing this project
- awesome-modernization - https://github.com/psalaets/vue-jscodeshift-adapter
README
# vue-jscodeshift-adapter
[![Build Status](https://travis-ci.org/psalaets/vue-jscodeshift-adapter.svg?branch=master)](https://travis-ci.org/psalaets/vue-jscodeshift-adapter)
Run [jscodeshift](https://github.com/facebook/jscodeshift) on Vue single file components
## Install
```
npm install vue-jscodeshift-adapter -D
```## Usage
The instructions below assume you're familiar with [jscodeshift](https://github.com/facebook/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 ``|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
```js
// 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](https://github.com/facebook/jscodeshift#usage-cli) for more info on jscodeshift CLI.
## License
MIT