Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update migrate #3021

Merged
merged 1 commit into from
Feb 27, 2025
Merged

Conversation

oasis-cloud
Copy link
Collaborator

@oasis-cloud oasis-cloud commented Feb 26, 2025

Summary by CodeRabbit

  • 文档更新
    • 更新迁移指南,重点说明从 NutUI React 2.x 到 3.x 的过渡,精简了不兼容更新说明。
    • 优化了组件使用说明,调整了对滚动属性的描述,移除了部分平台相关的说明。
  • 新功能
    • 新增并优化了组件库,添加了边栏 (SideBar) 和选择视图 (PickerView) 组件,提升了整体使用体验。

Copy link

coderabbitai bot commented Feb 26, 2025

Walkthrough

该 PR 主要更新了 NutUI React 的迁移说明文档,将重点由从 1.x 到 2.x 的升级调整为从 2.x 到 3.x 的更新进程。文档中移除了 codemod CLI 工具的升级说明,新增了针对 Babel 导入插件自定义名称函数的介绍,使组件导入路径更加灵活。同时,新增了 SideBarPickerView 两个组件,并对部分组件进行了分类与描述调整。此外,还修改了 BackTop 组件中 scrollRes 属性的描述,去掉了对 rn 与 鸿蒙端的说明。

Changes

文件 更改描述
migrate-from-v2.md 更新迁移文档:目标版本改为 3.x;移除 CLI 升级说明;新增 Babel 插件自定义名称函数说明;新增 SideBarPickerView 组件,并调整组件分类与不兼容更新说明。
src/.../doc.taro.md (BackTop 组件) 修改 scrollRes 属性描述,移除对 rn 与 鸿蒙端的引用说明。

Sequence Diagram(s)

sequenceDiagram
    participant 开发者 as 开发者
    participant Babel as Babel 导入插件
    participant NutUI as NutUI React Taro包
    开发者->>Babel: 提供自定义名称函数
    Babel->>NutUI: 依据自定义规则处理组件导入
    NutUI-->>开发者: 返回对应组件
Loading

Possibly related PRs

Suggested reviewers

  • xiaoyatong
  • irisSong

Poem

我是一只小兔子,蹦跳于代码间,
更新文档新风起,迁移说明展新篇,
SideBar 与 PickerView 闪耀登场,
模块调整齐协作,未来路上多欢颜,
跟着代码一同跳跃,🐰💻 拼搏不停歇!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added action:review This PR needs more reviews (less than 2 approvals) 3.x Target branch 3.x labels Feb 26, 2025
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.82%. Comparing base (cb7c2c2) to head (627f230).
Report is 1 commits behind head on feat_v3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           feat_v3.x    #3021   +/-   ##
==========================================
  Coverage      85.82%   85.82%           
==========================================
  Files            281      281           
  Lines          18494    18494           
  Branches        2803     2803           
==========================================
  Hits           15873    15873           
  Misses          2616     2616           
  Partials           5        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
migrate-from-v2.md (1)

178-186: ⚠️ Potential issue

Uploader 组件重大更新
Uploader 组件中移除了内部 ajax 逻辑、多个网络配置 props 及事件触发函数,同时新增了 onOverCountonUploadQueueChange 属性和 upload 方法,并调整了类型定义。此处更新幅度较大,建议确保文档中详细描述每项变更的细节,以及可能的迁移指南和示例,帮助使用者平滑过渡。

🧹 Nitpick comments (11)
migrate-from-v2.md (11)

21-22: 更新不兼容变更说明
新增的说明“从 NutUI React 2.x 到 NutUI React 3.x 存在一些不兼容更新,需要仔细阅读不兼容更新内容,并依次处理。”清晰地提示了升级过程中的关键注意事项,建议确认文档中有更多不兼容示例以帮助开发者理解。


33-46: H5 配置中 customName 函数的更新
在 H5 的 Babel 配置中,新增加的 "customName" 函数用于生成组件导入路径。请确认返回值 @nutui/nutui-react-taro/dist/es/packages/${name.toLowerCase()} 符合预期,并与库结构保持一致。


54-66: Taro 配置中 customName 函数的更新
在 Taro 配置中,同样新增了 "customName" 函数,返回值与 H5 配置保持统一。建议验证此配置在实际项目中能正确解析组件路径,并符合预期。


104-108: Grid 组件更新建议
Grid 组件中将 square 属性默认值调整为 true,并新增了两个主题变量。然而,列表中第 108 行仅有一个单独的破折号,显得不完整。建议检查是否有遗漏的信息或移除此多余的破折号以优化文档排版。


128-131: NavBar 组件 API 调整说明
移除 titleAlign 属性并新增 title 属性,同时说明当存在 children 时采用 left 对齐。该说明清晰,但建议补充示例说明在何种场景下 children 会触发 left 对齐。


138-139: SideNavBar 弃用提醒格式问题
SideNavBar 弃用提醒中使用了强调标记,存在多余的空格 (“** 该组件即将被废弃。请使用 SideBar **”)。建议去除标记内的空格,使其符合 markdownlint MD037 规范,例如改为 “该组件即将被废弃。请使用 SideBar”。

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

138-138: Spaces inside emphasis markers
null

(MD037, no-space-in-emphasis)


138-138: Spaces inside emphasis markers
null

(MD037, no-space-in-emphasis)


164-166: Rate 组件 API 更新
新增了 size 属性和 showScore 属性,用于控制图标大小和显示评分文案。建议在文档中添加具体示例,说明这两个属性的使用效果。


172-174: TextArea 组件 API 更新说明
为 TextArea 组件新增了 plainstatus 属性,同时移除了一些基础样式变量。建议在文档中补充如何使用这两个属性及推荐的样式变量示例,便于开发者理解变更影响。


207-208: InfiniteLoading 组件 API 补充
新增了对 target 属性的说明,用于监听目标元素。建议在文档中添加具体示例,确保用户能理解如何正确使用该属性。


238-240: CountDown 组件新增 type 属性
新增的 type 属性用于设置组件变体类型,建议补充详细说明及示例,帮助用户理解不同类型之间的差异。


245-247: Empty 组件主题变量调整
移除了 --nutui-empty-title-margin-top--nutui-empty-description-margin-top 主题变量。建议在文档中提醒开发者如有需要,可采用新的变量或调整样式策略。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb7c2c2 and 627f230.

📒 Files selected for processing (2)
  • migrate-from-v2.md (5 hunks)
  • src/packages/backtop/doc.taro.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
migrate-from-v2.md

138-138: Spaces inside emphasis markers
null

(MD037, no-space-in-emphasis)


138-138: Spaces inside emphasis markers
null

(MD037, no-space-in-emphasis)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: test
🔇 Additional comments (8)
migrate-from-v2.md (8)

73-77: 新增组件部分
文档中新增了 “SideBar” 和 “PickerView” 两个组件。建议在后续版本中为这些组件提供详细的使用示例和说明,帮助开发者快速上手。


88-89: Button 组件 API 调整
移除了样式变量 --nutui-button-default-font-weight。请确认这一变更不会对现有主题定制产生负面影响,如有必要在变更说明中指出备选方案或升级提示。


120-122: Indicator 组件 API 更新
新增了 typecolor 属性,以及调整了 total 属性的默认值。建议在文档中补充详细说明和使用示例,帮助用户理解这些变化的目的和使用场景。


134-135: Pagination 组件 itemRender 类型更新
itemRender 属性类型已更新为 (page: any, index: number) => ReactNode,建议仔细验证此更改对现有用例的兼容性,并在文档中提供相关说明或示例。


194-196: BackTop 组件 Taro 版本更新确认
在 BackTop 的 API 调整中,明确指出 Taro 版本新增了对鸿蒙端的支持,并增加了 scrollRes 属性。建议确保文档在描述该属性时与其它平台保持一致,并补充说明此属性实际作用。


215-216: Switch 组件属性类型更新
activeTextinactiveText 属性的类型更新为 ReactNode,这将允许更灵活的文本内容展示。该变更说明明确,建议在后续提供具体示例以展示可定制的效果。


230-231: Badge 组件 API 调整
Badge 组件新增 size 属性,并移除了 color 属性,通过 CSS 变量 --nutui-badge-background-color 实现背景色定制。建议在文档中明确示例,帮助用户快速了解如何进行样式定制。


254-256: Price 组件 API 更新
Price 组件更新中增加了 'xlarge' 尺寸并新增 color 属性,用以支持更多价格显示样式。建议检查各平台显示效果是否一致,并在文档中补充示例说明。

@@ -61,7 +61,7 @@ import { BackTop } from '@nutui/nutui-react-taro'
| threshold | 页面垂直滚动多高后出现 | `number` | `200` |
| zIndex | 设置组件页面层级 | `number` | `900` |
| duration | 设置动画持续时间,为 0 时表示无动画 | `number` | `1000` |
| scrollRes | 被监听容器滚动时的回调参数,主要用于 rn、鸿蒙端 | `PageScrollObejct` | `-` |
| scrollRes | 被监听容器滚动时的回调参数 | `PageScrollObejct` | `-` |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

检查属性类型拼写
scrollRes 属性的类型描述中出现了 PageScrollObejct,可能存在拼写错误。建议将其更正为 PageScrollObject,以保持文档的准确性。

-| `PageScrollObejct`
+| `PageScrollObject`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| scrollRes | 被监听容器滚动时的回调参数 | `PageScrollObejct` | `-` |
| scrollRes | 被监听容器滚动时的回调参数 | `PageScrollObject` | `-` |

@xiaoyatong xiaoyatong merged commit 7b5fd5e into jdf2e:feat_v3.x Feb 27, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Target branch 3.x action:review This PR needs more reviews (less than 2 approvals) size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants