项目作者: jondlm

项目描述 :
A collection of useful jscodeshift scripts for libraries we use at AppNexus
高级语言: JavaScript
项目地址: git://github.com/jondlm/anx-codemod.git
创建时间: 2017-02-09T17:48:08Z
项目社区:https://github.com/jondlm/anx-codemod

开源协议:

下载


anx-codemod

A collection of jscodeshift scripts.

Setup & Run

  • npm install -g jscodeshift
  • git clone git@github.com:jondlm/anx-codemod.git
  • Run npm install or yarn in the anx-codemod directory
  • jscodeshift -t <codemod-script> <path>
  • Use the --extensions js,jsx option if you use JSX, -d for a dry-run,
    -p to print the output for comparison

Included Scripts

anx-react-path-imports

Updates all ES6 module imports from anx-react into path imports.

From

  1. import {
  2. DataTablePanel,
  3. lucid,
  4. volatile,
  5. } from 'anx-react';
  6. const { Button } = lucid;
  7. const { Bert } = volatile;

To

  1. import DataTablePanel from 'anx-react/DataTablePanel';
  2. import Button from 'anx-react/lucid/Button';
  3. import Bert from 'anx-react/volatile/Bert';

lucid-path-imports

Updates all ES6 module imports from lucid-ui into path imports.

  1. import { Button } from 'lucid-ui';

To

  1. import Button from 'lucid-ui/Button';