All Projects → ant-design → codemod-v4

ant-design / codemod-v4

Licence: MIT License
codemod cli for antd v4 upgrade

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to codemod-v4

preact-codemod
🍧 Shave some bytes by using Preact.
Stars: ✭ 39 (-53.57%)
Mutual labels:  codemod, jscodeshift
tiny-treeshaker
🌳🥤 A tiny codemod for tree shaking (experimental) 🌳🥤
Stars: ✭ 92 (+9.52%)
Mutual labels:  codemod, jscodeshift
promotion-web
基于React: v18.x.x/Webpack: v5.x.x/React Router v6.x.x/ Antd: v5..x.x/Fetch Api/ Typescript: v4.x.x 等最新版本进行构建...
Stars: ✭ 374 (+345.24%)
Mutual labels:  antd, antd4
laravel-react-boilerplate
Laravel React Boilerplate with Ant Design, Route-Level Code Splitting, Redux, Sanctum Auth
Stars: ✭ 49 (-41.67%)
Mutual labels:  antd, antd4
font-awesome-codemod
⚙️ Font Awesome codemod script
Stars: ✭ 46 (-45.24%)
Mutual labels:  codemod, jscodeshift
async-await-codemod
Codemod script for migrating promise-based functions to use async/await syntax
Stars: ✭ 22 (-73.81%)
Mutual labels:  codemod, jscodeshift
ember-angle-brackets-codemod
Codemod to convert curly braces syntax to angle brackets syntax
Stars: ✭ 58 (-30.95%)
Mutual labels:  codemod, jscodeshift
es5-function-to-class-codemod
📦 Transform ES5 Functions to ES6 Classes
Stars: ✭ 30 (-64.29%)
Mutual labels:  codemod, jscodeshift
jscodeshift-typescript-example
jscodeshift typescript codemod example
Stars: ✭ 27 (-67.86%)
Mutual labels:  codemod, jscodeshift
trackupdates
A simple yaml-based xpath crawler framework for easy tracking site updates. https://zhupeng.github.io/
Stars: ✭ 20 (-76.19%)
Mutual labels:  antd
antd-color-replacer
适用于 webpack 环境下 的 主题切换插件
Stars: ✭ 22 (-73.81%)
Mutual labels:  antd
antd-curd
📦 基于 ant design 、 dva 、 antd-form-mate 的增删改查页面组件。
Stars: ✭ 26 (-69.05%)
Mutual labels:  antd
pityWeb
🎉一个持续迭代的开源接口测试平台(前端),欢迎大家多提issue多给反馈。 求star⭐,我会努力更新下去的!
Stars: ✭ 25 (-70.24%)
Mutual labels:  antd
pocassistweb
web ui of pocassist
Stars: ✭ 23 (-72.62%)
Mutual labels:  antd
react-smart-app
Preconfiguration React + Ant Design + State Management
Stars: ✭ 13 (-84.52%)
Mutual labels:  antd
ant-design-snippets
ant-design-snippets
Stars: ✭ 18 (-78.57%)
Mutual labels:  antd
GOSH-FHIRworks2020-React-Dashboard
🩺 Fully Responsive FHIR Dashboard written using @reactjs for NHS and GOSH hackathon
Stars: ✭ 21 (-75%)
Mutual labels:  antd
rn-update-deprecated-modules
Codemod to update import declarations as per react-native > 0.59.x deprecations.
Stars: ✭ 73 (-13.1%)
Mutual labels:  codemod
reactjs-boilerplate
Reactjs setup with babel, webpack with basic loaders, ant design, react-router and optimized for production using code splitting and lazy loading.
Stars: ✭ 40 (-52.38%)
Mutual labels:  antd
react-template
An enterprise react template application showcasing - Testing strategy, Global state management, middleware support, a network layer, component library integration, localization, PWA support, route configuration, lazy loading and CI/CD
Stars: ✭ 44 (-47.62%)
Mutual labels:  antd

English | 简体中文

Ant Design v4 Codemod

A collection of codemod scripts that help upgrade antd v4 using jscodeshift.(Inspired by react-codemod)

NPM version NPM downloads CircleCI

Usage

Before run codemod scripts, you'd better make sure to commit your local git changes firstly.

# global installation
npm i -g @ant-design/codemod-v4
# or for yarn user
#  yarn global add @ant-design/codemod-v4
antd4-codemod src

# use npx
npx -p @ant-design/codemod-v4 antd4-codemod src

Codemod scripts introduction

v3-Component-to-compatible

Replace deprecated Form and Mention from @ant-design/compatible:

- import { Form, Input, Button, Mention } from 'antd';
+ import { Form, Mention } from '@ant-design/compatible';
+ import '@ant-design/compatible/assets/index.css';
+ import { Input, Button } from 'antd';

  ReactDOM.render( (
    <div>
      <Form>
        {getFieldDecorator('username')(<Input />)}
        <Button>Submit</Button>
      </Form>
      <Mention
        style={{ width: '100%' }}
        onChange={onChange}
        defaultValue={toContentState('@afc163')}
        defaultSuggestions={['afc163', 'benjycui']}
        onSelect={onSelect}
      />
    </div>
  );

v3-component-with-string-icon-props-to-v4

Update component which contains string icon props with specific v4 Icon component from @ant-design/icons.

  import { Avatar, Button, Result } from 'antd';
+ import { QuestionOutlined, UserOutlined } from '@ant-design/icons';

  ReactDOM.render(
    <div>
-     <Button type="primary" shape="circle" icon="search" />
+     <Button type="primary" shape="circle" icon={SearchOutlined} />
-     <Avatar shape="square" icon="user" />
+     <Avatar shape="square" icon={UserOutlined} />
      <Result
-       icon="question"
+       icon={<QuestionOutlined />}
        title="Great, we have done all the operations!"
        extra={<Button type="primary">Next</Button>}
      />
    </div>,
    mountNode,
  );

v3-Icon-to-v4-Icon

Replace v3 Icon with specific v4 Icon component.

- import { Icon, Input } from 'antd';
+ import { Input } from 'antd';
+ import Icon, { CodeFilled, SmileOutlined, SmileTwoTone } from '@ant-design/icons';

  const HeartSvg = () => (
    <svg width="1em" height="1em" fill="currentColor" viewBox="0 0 1024 1024">
      <path d="M923 plapla..." />
    </svg>
  );

  const HeartIcon = props => <Icon component={HeartSvg} {...props} />;

  ReactDOM.render(
    <div>
-     <Icon type="code" theme="filled" />
+     <CodeFilled />
-     <Icon type="smile" theme="twoTone" twoToneColor="#eb2f96" />
+     <SmileTwoTone twoToneColor="#eb2f96" />
-     <Icon type="code" theme={props.fill ? 'filled' : 'outlined'} />
+     <LegacyIcon type="code" theme={props.fill ? 'filled' : 'outlined'} />
      <HeartIcon />
      <Icon viewBox="0 0 24 24">
        <title>Cool Home</title>
        <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />
      </Icon>
      <Input suffix={<SmileOutlined />} />
    </div>,
    mountNode,
  );

v3-LocaleProvider-to-v4-ConfigProvider

Replace v3 LocaleProvider with v4 ConfigProvider component.

- import { LocaleProvider } from 'antd';
+ import { ConfigProvider } from 'antd';

  ReactDOM.render(
-   <LocaleProvider {...yourConfig}>
+   <ConfigProvider {...yourConfig}>
      <Main />
-   </LocaleProvider>
+   </ConfigProvider>
    mountNode,
  );

v3-Modal-method-with-icon-to-v4

Update Modal.method() which contains string icon property with specific v4 Icon component.

import { Modal } from 'antd';
+ import { AntDesignOutlined } from '@ant-design/icons';

  Modal.confirm({
-   icon: 'ant-design',
+   icon: <AntDesignOutlined />,
    title: 'Do you Want to delete these items?',
    content: 'Some descriptions',
    onOk() {
      console.log('OK');
    },
    onCancel() {
      console.log('Cancel');
    },
  });

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].