0.1.1 • Published 7 years ago
@patternfly-test/react-codemods v0.1.1
@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 jscodeshiftyarn install @patternfly-test/react-codemodsjscodeshift -t node_modules/@patternfly-test/react-codemods/transforms/[transform].js [files]path- files or directory to transform;- use the
-doption for a dry-run and use-pto print the output for comparison; - use the
--extensionsoption 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';