Neatly Punctuated Musings

    @patternfly-test/react-codemods

    0.1.1 • Public • Published

    @patternfly-test/react-codemods

    This repository contains a collection of codemod scripts for use with JSCodeshift that help update Patternfly React projects.

    Setup & Run

    1. yarn global add jscodeshift
    2. yarn install @patternfly-test/react-codemods
    3. 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.
    4. 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';

    Install

    npm i @patternfly-test/react-codemods

    DownloadsWeekly Downloads

    1

    Version

    0.1.1

    License

    Apache-2.0

    Unpacked Size

    3.83 kB

    Total Files

    5

    Last publish

    Collaborators

    • dougmiller
    • patterfly-test-user
    • priley86