Code Monkey home page Code Monkey logo

antd-codemod's Introduction

antd-codemod

Dependency Status

This repository contains a collection of codemod scripts based for use with JSCodeshift that help update antd APIs.

Setup & Run

  • npm install -g jscodeshift
  • git clone https://github.com/ant-design/antd-codemod.git or download a zip file from https://github.com/ant-design/antd-codemod/archive/master.zip
  • Run npm install in the antd-codemod directory
  • jscodeshift -t <codemod-script> <path>
  • Use the -d option for a dry-run and use -p to print the output for comparison

Included Scripts

1.x-2.x

getFieldProps-to-getFieldDecorator

Replace deprecated getFieldProps with newer getFieldDecorator:

-  <Input placeholder="text" {...getFieldProps('userName', { ... })} />
+  {getFieldDecorator('userName', { ... })(
+    <Input placeholder="text" />
+  )}

Popover-overlay-to-content

Popover[overlay] is removed, so we need to replace it with Popover[content]:

- <Popover overlay={...} />
+ <Popover content={...} />

time-related-value-to-moment

Update value defaultValue and format of DatePicker TimePicker Calendar MonthPicker(not support RangePicker now):

+ import moment from 'moment';

  <DatePicker
-   defaultValue="2016-11-24 00:00:00"
+   defaultValue={moment('2016-11-24 00:00:00', 'YYYY-MM-DD HH:mm:ss')}
    showTime
-   format="yyyy-MM-dd HH:mm:ss"
+   format="YYYY-MM-DD HH:mm:ss"
  />

GergorianCalendar-to-moment

Update GregorianCalendar's APIs to moment's APIs.

function disabledDate(date) {
- console.log(date.getTime());
+ console.log(date.valueOf());
}

License

MIT

antd-codemod's People

Contributors

benjycui avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.