Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/ant-design/antd-codemod

antd codemod scripts.
https://github.com/ant-design/antd-codemod

Last synced: 11 days ago
JSON representation

antd codemod scripts.

Lists

README

        

# antd-codemod

[![](https://img.shields.io/travis/ant-design/antd-codemod.svg?style=flat-square)](https://travis-ci.org/ant-design/antd-codemod)
[![Dependency Status](https://david-dm.org/ant-design/antd-codemod.svg?style=flat-square)](https://david-dm.org/ant-design/antd-codemod)

This repository contains a collection of codemod scripts based for use with [JSCodeshift](https://github.com/facebook/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 `
* 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`:

```diff
-
+ {getFieldDecorator('userName', { ... })(
+
+ )}
```

#### `Popover-overlay-to-content`

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

```diff
-
+
```

#### `time-related-value-to-moment`

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

```diff
+ import moment from 'moment';


```

#### `GergorianCalendar-to-moment`

Update GregorianCalendar's APIs to moment's APIs.

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

## License

MIT