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 dependencies and import paths to @rc-component packages dependencies #756

Merged
merged 6 commits into from
Feb 25, 2025

Conversation

aojunhao123
Copy link
Contributor

@aojunhao123 aojunhao123 commented Feb 23, 2025

Summary by CodeRabbit

  • 文档更新
    • 更新了多个示例中的组件引用路径,确保一致性。
    • 优化了文档中的API说明,提升了易读性。
  • 维护优化
    • 更新了依赖项及构建脚本,增强了项目的一致性与稳定性。
    • 修改了模块路径别名,反映了库的组织结构变化。
  • 代码重构与格式优化
    • 统一并调整了内部模块引用及代码格式,改善了代码的可维护性。
    • 重新格式化了接口定义和JSX结构,提高了可读性。
    • 修改了函数声明语法,增强了代码一致性。
  • 测试更新
    • 优化了测试配置和引用路径,确保测试流程的稳定可靠。

Copy link

coderabbitai bot commented Feb 23, 2025

"""

Walkthrough

本次提交主要对文档、示例、源码和测试文件进行了格式调整与依赖迁移。主要改动包括:更新 README 中兼容性表格格式及 API 描述;示例和源码文件中,将各模块的导入路径从旧包(如 rc-motionrc-util)更新为新包(如 @rc-component/motion@rc-component/util);调整部分代码缩进和格式;同时在 package.json 中更新预发布脚本及依赖项。整体变动均未引入新功能,也没有调整业务逻辑。

Changes

文件范围 变更内容
README.md 更新兼容性表格格式;调整 API 中 openAnimation 属性描述,由 rc-motion 改为 @rc-component/motion
docs/examples/*.tsx 修改 CSSMotionProps 的导入路径从 rc-motion@rc-component/motion;在 rtl-antd.tsx 中调整 CommonMenuState 的缩进。
package.json 更新预发布脚本由 np --yolo --no-publish 改为 rc-np;移除/更新部分依赖项(如移除 @babel/runtimenprc-motion;新增 @rc-component/motion@rc-component/util@rc-component/np;更新 @rc-component/trigger 版本)。
src/*.tsx (包括 Menu.tsx、MenuItem.tsx、MenuItemGroup.tsx、SubMenu/*、context 文件、hooks 及 utils) 统一更新各模块中多个导入路径:将 rc-motionrc-util 改为 @rc-component/motion@rc-component/util;部分文件中做了缩进与解构格式等小幅调整。
tests/*.tsx 更新测试文件中的导入路径,如 KeyCodespyElementPrototypesresetWarned 等由 rc-utilrc-motion 切换至对应的 @rc-component 包;调整部分 prop 类型转换语法。

Poem

我是跳跃的小兔,敲击代码不知倦,
路径更新如春风,导入焕然展新颜。
表格美化亦无声,依赖更迭细如丝,
每一行代码闪烁,记录变动的奇幻。
跳跃在代码森林间,快乐随改动同行 🐇✨
"""


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e983bb0 and c1d76a0.

📒 Files selected for processing (1)
  • package.json (2 hunks)
🔇 Additional comments (4)
package.json (4)

2-3: 更新包名与版本号
行 2-3 将包名更新为 "@rc-component/menu" 并将版本号升级为 "1.0.0"。这一修改符合依赖迁移的要求,同时也需要确认客户端和相关文档的更新。


40-41: 更新预发布与发布脚本
行 40-41 中调整了预发布和发布脚本:将 prepublishOnly 修改为 "npm run compile && rc-np",并将 postpublish 更新为 "tnpm sync @rc-component/menu"。请确保新脚本在发布流程中正常工作。


47-51: 更新依赖项配置
行 47-51 引入了新的依赖项 "@rc-component/motion": "^1.1.4""@rc-component/util": "^1.0.0",同时更新了 "@rc-component/trigger" 的版本,并确认 "rc-overflow" 的版本符合预期。建议检查项目内其它模块是否需要同步更新对应的引用。


54-55: 更新开发依赖项
行 54-55 中,将 "@rc-component/father-plugin" 更新至 "^2.0.2",并引入了新的开发依赖 "@rc-component/np": "^1.0.3"。请确认这些开发依赖的更新不会影响到构建与测试流程。


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. (Beta)
  • @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.

Copy link

socket-security bot commented Feb 23, 2025

@aojunhao123 aojunhao123 changed the title chore: update dependencies and import paths to @rc-component packages chore: update dependencies and import paths to @rc-component packages dependencies Feb 23, 2025
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: 0

🧹 Nitpick comments (2)
src/utils/commonUtil.ts (2)

16-16: 建议改进临时键的前缀命名

当前使用的 tmp_key- 前缀较为简单,建议使用更具描述性的前缀以提高代码可读性。

建议修改为:

-      eventKey = `tmp_key-${[...keyPath, index].join('-')}`;
+      eventKey = `menu_item_key-${[...keyPath, index].join('-')}`;

21-23: 建议增强开发环境警告信息

当前的警告实现仅设置了 warnKey 标志,建议添加更详细的警告信息以帮助开发者快速定位问题。

建议修改为:

 if (process.env.NODE_ENV !== 'production' && emptyKey) {
-  cloneProps.warnKey = true;
+  cloneProps.warnKey = {
+    message: '菜单项缺少 key 或 eventKey 属性',
+    path: keyPath.join(' > '),
+    index
+  };
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a6ac700 and deb5485.

📒 Files selected for processing (24)
  • README.md (2 hunks)
  • docs/examples/antd.tsx (1 hunks)
  • docs/examples/debug.tsx (1 hunks)
  • docs/examples/rtl-antd.tsx (2 hunks)
  • package.json (1 hunks)
  • src/Menu.tsx (1 hunks)
  • src/MenuItem.tsx (1 hunks)
  • src/MenuItemGroup.tsx (1 hunks)
  • src/SubMenu/InlineSubMenuList.tsx (2 hunks)
  • src/SubMenu/PopupTrigger.tsx (1 hunks)
  • src/SubMenu/index.tsx (1 hunks)
  • src/context/MenuContext.tsx (1 hunks)
  • src/hooks/useAccessibility.ts (3 hunks)
  • src/hooks/useKeyRecords.ts (1 hunks)
  • src/hooks/useUUID.ts (1 hunks)
  • src/utils/commonUtil.ts (1 hunks)
  • src/utils/motionUtil.ts (1 hunks)
  • src/utils/warnUtil.ts (1 hunks)
  • tests/Focus.spec.tsx (1 hunks)
  • tests/Keyboard.spec.tsx (1 hunks)
  • tests/Menu.spec.tsx (3 hunks)
  • tests/MenuItem.spec.tsx (1 hunks)
  • tests/Responsive.spec.tsx (1 hunks)
  • tests/SubMenu.spec.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (20)
  • src/utils/warnUtil.ts
  • src/utils/motionUtil.ts
  • src/SubMenu/InlineSubMenuList.tsx
  • src/MenuItemGroup.tsx
  • src/SubMenu/index.tsx
  • src/hooks/useKeyRecords.ts
  • tests/Responsive.spec.tsx
  • tests/SubMenu.spec.tsx
  • tests/Focus.spec.tsx
  • docs/examples/antd.tsx
  • src/hooks/useUUID.ts
  • tests/MenuItem.spec.tsx
  • docs/examples/debug.tsx
  • src/SubMenu/PopupTrigger.tsx
  • src/context/MenuContext.tsx
  • tests/Keyboard.spec.tsx
  • src/MenuItem.tsx
  • docs/examples/rtl-antd.tsx
  • src/hooks/useAccessibility.ts
  • src/Menu.tsx
🔇 Additional comments (9)
src/utils/commonUtil.ts (1)

1-1: 导入路径更新符合预期!

rc-util 迁移到 @rc-component/util 的更改与 PR 的目标保持一致。

tests/Menu.spec.tsx (3)

4-5: 更新了依赖包的导入路径

导入路径从 rc-util 更新为 @rc-component/util,这是一个正确的改动,与 package.json 中的依赖更新保持一致。


23-25: 更新了 mock 模块的导入路径

将 rc-motion 的 mock 更新为 @rc-component/motion,这个改动与依赖更新保持一致。


336-340: 类型断言语法优化

将类型断言的语法从 (x as unknown) as T 简化为 x as unknown as T,这是一个更简洁的写法。

package.json (3)

40-40: 更新了发布前脚本

将发布前脚本从 np --yolo --no-publish 更新为 rc-np,这与新增的 @rc-component/np 依赖相匹配。


47-50: 更新了核心依赖包

新增了以下 @rc-component 系列依赖:

  • @rc-component/motion: ^1.1.4
  • @rc-component/trigger: ^3.0.0
  • @rc-component/util: ^1.0.0

这些更新与代码中的导入路径变更保持一致。


55-55: 新增了发布工具依赖

新增了 @rc-component/np 依赖,用于替代原有的 np 包,这与发布脚本的更新相对应。

README.md (2)

58-59: 改进了兼容性表格的格式

优化了表格分隔符的格式,提高了文档的可读性。


175-175: 更新了 openAnimation 属性的文档

将文档中的 rc-motion 引用更新为 @rc-component/motion,保持与依赖更新的一致性。

@zombieJ zombieJ self-assigned this Feb 25, 2025
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: 0

🧹 Nitpick comments (1)
README.md (1)

170-170: API 描述更新确认:引用更新正确
第170行已将 openAnimation 属性的描述中原先的 “rc-motion” 更新为 “@rc-component/motion”。建议进一步优化描述文本,例如更改为“在子菜单打开或关闭时应用动画效果;详细对象类型请参见 @rc-component/motion 文档。” 以增强语句流畅性和清晰度。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 61a6467 and e983bb0.

📒 Files selected for processing (2)
  • .prettierrc (1 hunks)
  • README.md (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .prettierrc
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~7-~7: Using many exclamation marks might seem excessive (in this case: 4 exclamation marks for a text that’s 2227 characters long)
Context: ...u [![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundl...

(EN_EXCESSIVE_EXCLAMATION)

🔇 Additional comments (1)
README.md (1)

7-7: 徽章展示格式调整:确认单行显示徽章
目前第7行中将所有徽章放在了一行,这可以让 README 看起来更加紧凑。但请确认各个徽章之间有足够空白分隔以保证可读性。

🧰 Tools
🪛 LanguageTool

[style] ~7-~7: Using many exclamation marks might seem excessive (in this case: 4 exclamation marks for a text that’s 2227 characters long)
Context: ...u [![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundl...

(EN_EXCESSIVE_EXCLAMATION)

@yoyo837
Copy link
Member

yoyo837 commented Feb 25, 2025

不应该等 #745 先合并吗?

@zombieJ
Copy link
Member

zombieJ commented Feb 25, 2025

不应该等 #745 先合并吗?

一样的,两个合完再发。

Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.59%. Comparing base (a6ac700) to head (c1d76a0).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #756   +/-   ##
=======================================
  Coverage   99.59%   99.59%           
=======================================
  Files          27       27           
  Lines         738      738           
  Branches      202      202           
=======================================
  Hits          735      735           
  Misses          3        3           

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

@zombieJ zombieJ merged commit eda49a3 into react-component:master Feb 25, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants