portal icon indicating copy to clipboard operation
portal copied to clipboard

chore: use rc-component/util

Open li-jia-nan opened this issue 10 months ago • 3 comments

Summary by CodeRabbit

发行说明

  • 依赖更新

    • 将包版本从 1.1.2 升级到 2.0.0
    • 替换 rc-util 依赖为 @rc-component/util
    • 更新 React 类型定义到最新版本
  • 代码改进

    • 更新导入路径和模块引用
    • 增强 TypeScript 类型安全性
    • 重构部分函数声明方式
  • 测试更新

    • 更新测试用例中的模块引用
    • 为引用添加更精确的类型标注

li-jia-nan avatar Jan 25 '25 23:01 li-jia-nan

"""

概述

遍历

这个拉取请求主要涉及将依赖从 rc-util 迁移到 @rc-component/util,同时更新了项目的版本号到 2.0.0。更改包括更新导入路径、调整类型定义、添加更精确的类型注解,并对一些文件的函数声明方式进行了轻微修改。

变更

文件 变更摘要
.gitignore 添加 pnpm-lock.yaml 到忽略文件列表
package.json - 版本升级到 2.0.0
- 添加 @rc-component/util 依赖
- 移除 rc-util 依赖
- 更新 React 类型定义
docs/examples/getContainer.tsx
tests/index.test.tsx
useRef 添加明确的 HTML 元素类型
src/Portal.tsx
src/useDom.tsx
src/useScrollLocker.tsx
tests/webkit.test.tsx
更新导入路径从 rc-util@rc-component/util

诗歌

🐰 依赖的兔子跳跃变换,
从旧路径到新的天堂,
类型更安全,代码更明朗,
版本跃升至二点零,
兔子微笑,一切通畅! 🚀 """


📜 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 0f7ff351c5ad4f4bffeedd20e83efbbba1ebd4ad and 3f7beb2e96e370bd44c75cc1484dce55d8939c7b.

📒 Files selected for processing (1)
  • package.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: preview
🔇 Additional comments (4)
package.json (4)

3-3: 版本号升级需要更新文档

从 1.1.2 升级到 2.0.0 是一个重大版本更新,需要相应的文档支持。


57-58: 谨慎使用 React 19

注意到开发依赖中更新到了 React 19 相关包,但:

  1. React 19 目前仍在开发中,可能存在不稳定性
  2. devDependencies 使用了 React 19,但实际运行依赖仍是 React 18
  3. 这种不一致可能导致开发和生产环境的行为差异

建议:

  • 暂时保持使用稳定版本的 React 18
  • 或者在文档中明确说明对 React 19 的支持状态

Also applies to: 69-70


53-55: 测试库版本更新可能需要适配

测试相关依赖有较大版本更新:

  • @testing-library/jest-dom: 5.16.4 -> 6.6.3
  • @testing-library/react: 13.0.0 -> 16.2.0
  • @types/jest: 26.0.20 -> 29.5.14

建议:

  1. 检查现有测试是否需要适配新版本
  2. 确保所有测试用例都能正常运行
  3. 在升级说明中提及测试库的更新要求

48-49: 验证依赖迁移的兼容性

rc-util 替换为 @rc-component/util 是一个重要变更,需要确保:

  1. 所有 API 的兼容性
  2. 没有遗漏任何功能迁移
  3. 更新相关文档说明迁移步骤
✅ Verification successful

依赖迁移验证完成,确认兼容性良好

  • 所有 rc-util 的引用已完全迁移至 @rc-component/util
  • 新包提供了完全兼容的 API 实现
  • 包由同一团队维护,最近更新活跃(2周前发布新版本)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查 rc-util 的使用情况
echo "检查代码中是否还存在 rc-util 的引用..."
rg "rc-util"

echo -e "\n检查 @rc-component/util 的使用情况..."
rg "@rc-component/util"

Length of output: 1377


Script:

#!/bin/bash
# Install package locally to examine structure
npm install @rc-component/util

# Check package structure
echo "Package structure:"
ls -R node_modules/@rc-component/util/lib/

# Check package.json
echo -e "\nPackage information:"
cat node_modules/@rc-component/util/package.json

# Check types
echo -e "\nAvailable type definitions:"
find node_modules/@rc-component/util -name "*.d.ts"

Length of output: 10268


Script:

#!/bin/bash
# Get package details
echo "Package details:"
npm view @rc-component/util

# Get repository info
echo -e "\nRepository content:"
gh repo view rc-component/util --json description,homepageUrl,url

# Check specific files in repository
echo -e "\nChecking specific imported paths:"
curl -s https://raw.githubusercontent.com/react-component/util/master/src/hooks/useLayoutEffect.ts
echo -e "\n---\n"
curl -s https://raw.githubusercontent.com/react-component/util/master/src/Dom/canUseDom.ts

Length of output: 2435


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.

coderabbitai[bot] avatar Jan 25 '25 23:01 coderabbitai[bot]

🎊 PR Preview 3f7beb2e96e370bd44c75cc1484dce55d8939c7b has been successfully built and deployed to https://react-component-portal-preview-pr-23.surge.sh

🕐 Build time: 95.258s

🤖 By surge-preview

github-actions[bot] avatar Jan 25 '25 23:01 github-actions[bot]