https://github.com/jsdf/cjsx-codemod
A codemod for migrating off of coffee-react CJSX
https://github.com/jsdf/cjsx-codemod
Last synced: 12 months ago
JSON representation
A codemod for migrating off of coffee-react CJSX
- Host: GitHub
- URL: https://github.com/jsdf/cjsx-codemod
- Owner: jsdf
- Created: 2016-10-03T06:56:36.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-03T06:56:48.000Z (over 9 years ago)
- Last Synced: 2025-07-07T13:17:39.164Z (12 months ago)
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-codemods - cjsx-codemod - A codemod for migrating off of coffee-react CJSX. (Frameworks / React.js)
README
# cjsx-codemod
A codemod for migrating off [coffee-react](https://github.com/jsdf/coffee-react-transform) CJSX
## Usage
Install it:
```
npm install -g cjsx-codemod
```
Print command line options:
```
cjsx-codemod
```
Run the codemod on a directory tree of CJSX code:
```
cjsx-codemod ./my-app
```
Convert to using some custom DSL instead of `React.createElement`:
```
cjsx-codemod --jsx-import='myDSL = require "my-dsl"' --jsx-expression='`myDSL(${ELEMENT}, ${ARGS})`' ./my-app
```
Convert to using [teact](https://www.npmjs.com/package/teact):
```
cjsx-codemod --jsx-import='{crel} = require "teact"' --jsx-expression='`crel(${ELEMENT}, ${ARGS})`' ./my-app
```
Based on [jscodeshift](https://github.com/facebook/jscodeshift)