Skip to content

Commit

Permalink
Merge pull request #243 from oceanbase/dengfuping-dev
Browse files Browse the repository at this point in the history
feat(docs): Add auto migration docs for @oceanbase/design, @oceanbase/ui and @oceanbase/charts
  • Loading branch information
dengfuping authored Oct 30, 2023
2 parents 244f140 + cf9c56f commit 080ba92
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 2 deletions.
18 changes: 16 additions & 2 deletions docs/charts/charts-migrate-from-ant-design-charts.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
---
title: Ant Design Charts 迁移
title: @ant-design/charts 迁移
order: 10
group: 可视化图表
---

OceanBase Charts 与 AntV 设计体系一脉相承,完全兼容 [Ant Design Charts](https://charts.ant.design) 的能力和 API。两者仅在图表样式、交互和部分扩展能力上存在差异,因此只需简单替换模块入口,即可从 Ant Design Charts 平滑迁移至 OceanBase Charts。

## 自动化迁移

- 使用 [@oceanbase/codemod](https://github.com/oceanbase/oceanbase-design/tree/master/packages/codemod) 可以从 `@ant-design/charts` 一键迁移到 `@oceanbase/charts`:

```shell
# Run directly through npx
# `src` is the target directory or file that you want to transform.
npx -p @oceanbase/codemod codemod src
# options
# --disablePrettier // disable prettier
```

## 手动迁移

```diff
- import { xxx } from '@ant-design/charts';
+ import { xxx } from '@oceanbase/charts';
```

作为 OceanBase 的图表最佳实践,大多数情况下,只需指定数据相关属性、无需定制图表样式和交互,即可保证最佳展示效果。因此迁移至 OceanBase Charts 后,如无必要,建议去掉自定义样式,直接使用默认样式和交互即可
作为 OceanBase 的图表最佳实践,大多数情况下,只需指定数据相关属性、无需定制图表样式和交互,即可保证最佳展示效果。因此迁移至 OceanBase Charts 后,如无必要,建议去掉自定义样式,使用默认样式和交互即可
28 changes: 28 additions & 0 deletions docs/design/design-migrate-from-antd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: 从 antd 迁移
order: 5
group: 基础组件
---

OceanBase Design 与 Ant Design 设计体系一脉相承,完全兼容 [Ant Design](https://ant.design) 的能力和 API。两者仅在组件主题、样式和扩展能力上存在差异,因此只需简单替换模块入口,即可从 Ant Design 平滑迁移至 OceanBase Design。

## 自动化迁移

- 使用 [@oceanbase/codemod](https://github.com/oceanbase/oceanbase-design/tree/master/packages/codemod) 可以从 `antd` 一键迁移到 `@oceanbase/design`:

```shell
# Run directly through npx
# `src` is the target directory or file that you want to transform.
npx -p @oceanbase/codemod codemod src
# options
# --disablePrettier // disable prettier
```

## 手动迁移

```diff
- import { xxx } from 'antd';
- import { xxx } from 'antd/es/button';
+ import { xxx } from '@oceanbase/design';
+ import { xxx } from '@oceanbase/design/es/button';
```
19 changes: 19 additions & 0 deletions docs/design/design-migrate-from-obui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: 从 @alipay/ob-ui 迁移
order: 6
group: 基础组件
---

内部包 `@alipay/ob-ui` 由于包含多种类型的组件,不便于管理和使用。因此在对外开源时,将其拆分成了 `@oceanbase/design` 基础组件库和 `@oceanbase/ui` 业务组件库,且有一定的不兼容变更,建议使用我们提供的自动化工具进行迁移。

## 自动化迁移

- 使用 [@oceanbase/codemod](https://github.com/oceanbase/oceanbase-design/tree/master/packages/codemod) 可以从 `@alipay/ob-ui` 一键迁移到 `@oceanbase/design`:

```shell
# Run directly through npx
# `src` is the target directory or file that you want to transform.
npx -p @oceanbase/codemod codemod src
# options
# --disablePrettier // disable prettier
```
19 changes: 19 additions & 0 deletions docs/ui/ui-migrate-from-obui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: 从 @alipay/ob-ui 迁移
order: 6
group: 业务组件
---

内部包 `@alipay/ob-ui` 由于包含多种类型的组件,不便于管理和使用。因此在对外开源时,将其拆分成了 `@oceanbase/design` 基础组件库和 `@oceanbase/ui` 业务组件库,且有一定的不兼容变更,建议使用我们提供的自动化工具进行迁移。

## 自动化迁移

- 使用 [@oceanbase/codemod](https://github.com/oceanbase/oceanbase-design/tree/master/packages/codemod) 可以从 `@alipay/ob-ui` 一键迁移到 `@oceanbase/ui`:

```shell
# Run directly through npx
# `src` is the target directory or file that you want to transform.
npx -p @oceanbase/codemod codemod src
# options
# --disablePrettier // disable prettier
```
3 changes: 3 additions & 0 deletions packages/codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ Before run codemod scripts, you'd better make sure to commit your local git chan

```shell
# Run directly through npx
# `src` is the target directory or file that you want to transform.
npx -p @oceanbase/codemod codemod src
# options
# --disablePrettier // disable prettier
```

## Codemod scripts introduction
Expand Down

0 comments on commit 080ba92

Please sign in to comment.