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: about 2 months ago
JSON representation
antd codemod scripts.
- Host: GitHub
- URL: https://github.com/ant-design/antd-codemod
- Owner: ant-design
- License: mit
- Created: 2016-11-22T03:23:06.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-01T14:42:47.000Z (almost 4 years ago)
- Last Synced: 2024-11-02T20:33:25.940Z (2 months ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 20
- Watchers: 11
- Forks: 6
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-codemods - antd-codemod - Antd codemod scripts. (Libraries / ant-design)
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