@patternfly-test/react-codemods
v0.1.1
Published
This repository contains a collection of codemod scripts for use with [JSCodeshift](https://github.com/facebook/jscodeshift) that help update Patternfly React projects.
Downloads
2
Readme
@patternfly-test/react-codemods
This repository contains a collection of codemod scripts for use with JSCodeshift that help update Patternfly React projects.
Setup & Run
yarn global add jscodeshift
yarn install @patternfly-test/react-codemods
jscodeshift -t node_modules/@patternfly-test/react-codemods/transforms/[transform].js [files]
path
- files or directory to transform;- use the
-d
option for a dry-run and use-p
to print the output for comparison; - use the
--extensions
option if your files have different extensions than.js
(for example,--extensions js,jsx
); - if you use flowtype, you might also need to use
--parser=flow
; - see all available jscodeshift options.
- Review changes via git diff. Keep what you want, throw it out if you don't. Magic!
Included Scripts
patternfly-react-to-react-core
Converts imports of patternfly-react
to compatible @patternfly-test/react-core
;
jscodeshift -t node_modules/@patternfly-test/react-codemods/transforms/patternfly-react-to-react-core.js <path>
Before
import { Button, Alert } from 'patternfly-react';
After
import { Button, Alert } from '@patternfly-test/react-core';