Skip to content

Conversation

@aojunhao123
Copy link
Contributor

@aojunhao123 aojunhao123 commented Feb 26, 2025

Summary by CodeRabbit

  • Chores

    • 完成了包重构,更新了包名和依赖配置(版本号重置),确保工具链的统一和稳定。
  • Refactor

    • 优化和统一了内部模块引用与代码格式,提升了整体代码可读性和维护性,对用户体验无影响。
  • Tests

    • 调整了测试用例中模块引用,确保测试环境与全局依赖一致。
@vercel
Copy link

vercel bot commented Feb 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
image ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 0:51am
@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2025

"""

Walkthrough

本次更新主要涉及多个文件中的导入路径修改,将原来使用的 rc-xxx 更新为作用域统一的 @rc-component/xxx。示例文件、源代码、测试以及配置文件均进行了相应修改,包名和版本在 package.json 中也已调整,同时新增、升级或删除了部分依赖。所有更改均未修改功能逻辑,仅为包结构和代码格式作出更新。

Changes

文件路径 变更摘要
docs/examples/*.tsx 将所有示例文件中 Image 组件的导入路径从 rc-image 更新为 @rc-component/image,部分文件进行了轻微的格式调整。
package.json 修改包名和版本(从 rc-image@7.11.0@rc-component/image@1.0.0),更新依赖,新增 @rc-component/motion@rc-component/util@rc-component/dialog,移除旧依赖,并更换发布脚本。
src/**/.tsx
src/hooks/
.ts
更新各源码文件及钩子中依赖的导入路径,从 rc-dialogrc-utilrc-motion 更新为 @rc-component/dialog@rc-component/util@rc-component/motion,并对部分代码格式进行了优化。
tests/*.tsx 更新测试文件中对 rc-util 相关模块(如 domHookKeyCode)的导入路径到 @rc-component/util 对应模块。
tsconfig.json 更新模块路径别名,将 "rc-image": ["src/index.ts"] 修改为 "@rc-component/image": ["src/index.ts"]

Poem

我是跳跃的小兔子,
在代码林中轻快蹦跶,
旧路径换上新装,
依赖更新焕然一新,
代码的春风带来无限希望!
🐰✨
"""

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/hooks/useImageTransform.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.

The config "prettier" was referenced from the config file in "/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

src/Preview.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.

The config "prettier" was referenced from the config file in "/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

src/Image.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.

The config "prettier" was referenced from the config file in "/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

  • 5 others

Tip

CodeRabbit's docstrings feature is now available as part of our Pro Plan! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
@socket-security
Copy link

socket-security bot commented Feb 26, 2025

@codecov
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.79%. Comparing base (20afe8d) to head (e6fac67).
Report is 1 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@ ## master #377 +/- ## ======================================= Coverage 99.78% 99.79% ======================================= Files 15 15 Lines 470 486 +16 Branches 134 139 +5 ======================================= + Hits 469 485 +16  Misses 1 1 

☔ 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: 0

🧹 Nitpick comments (1)
src/util.ts (1)

10-27: 添加了从旧版 rc-util 包中复制的遗留工具函数

添加了 getOffset 函数以维持现有功能,但请注意代码中的 TODO 注释表明这是临时解决方案,未来应当移除。这种方法可以确保在迁移过程中不会破坏现有功能。

考虑在未来版本中使用 @rc-component/util 提供的等效功能来替代这个临时解决方案。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 30f3be4 and e6fac67.

⛔ Files ignored due to path filters (3)
  • tests/__snapshots__/controlled.test.tsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/preview.test.tsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/previewGroup.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (10)
  • .dumirc.ts (1 hunks)
  • README.md (2 hunks)
  • package.json (2 hunks)
  • src/Image.tsx (3 hunks)
  • src/Preview.tsx (4 hunks)
  • src/getFixScaleEleTransPosition.ts (1 hunks)
  • src/hooks/useImageTransform.ts (1 hunks)
  • src/hooks/useMouseEvent.ts (5 hunks)
  • src/hooks/useTouchEvent.ts (1 hunks)
  • src/util.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/getFixScaleEleTransPosition.ts
  • src/hooks/useTouchEvent.ts
  • src/hooks/useImageTransform.ts
  • src/hooks/useMouseEvent.ts
  • src/Preview.tsx
  • src/Image.tsx
🔇 Additional comments (9)
README.md (2)

58-58: 更新了导入声明以使用新的包命名空间

已将导入语句从 rc-image 更新为 @rc-component/image,符合组件库迁移到命名空间方式的目标。


99-99: 更新了 Image.PreviewGroup 示例中的导入声明

与之前的修改一致,这里将 rc-image 更新为 @rc-component/image,保持了代码示例的一致性。

.dumirc.ts (1)

6-7: 更新了别名配置以匹配新的包命名空间

别名配置从 rc-image$rc-image/es 更新为 @rc-component/image$@rc-component/image/es,确保了开发环境中的模块解析可以正确工作。这是组件库命名空间迁移过程中的必要步骤。

src/util.ts (1)

29-36: 添加了获取客户端尺寸的工具函数

新增的 getClientSize 函数用于获取视口的宽度和高度,实现简洁明了。这也是为了从旧版 rc-util 库迁移到新的命名空间结构。

package.json (5)

2-3: 更新了包名和版本号

将包名从 rc-image 更新为 @rc-component/image,并将版本重置为 1.0.0。这是组件库迁移到新命名空间的核心更改,版本重置符合语义化版本控制规范。


35-36: 更新了发布前脚本

prepublishOnly 脚本从使用 np 更新为 rc-np,与 @rc-component 生态系统的其他工具保持一致。


39-39: 添加了 TypeScript 类型检查脚本

新增了 tsc 脚本,使用 bunx tsc --noEmit 进行类型检查但不生成输出文件,有助于提高代码质量。


42-46: 更新了依赖项以使用新的命名空间包

将依赖项从旧版的 rc-* 包更新为使用 @rc-component 命名空间的新版本:

  1. 升级了 @rc-component/portal^1.0.2^2.0.0
  2. 新增了 @rc-component/motion@rc-component/util@rc-component/dialog 依赖

这些更改与整体命名空间迁移目标一致,确保了所有依赖都使用新的命名空间格式。


50-51: 更新了开发依赖

  1. 升级了 @rc-component/father-plugin^1.0.2^2.0.2
  2. 添加了 @rc-component/np 替代之前的 np

这些更改确保开发工具链与新的命名空间结构保持一致。

@zombieJ zombieJ merged commit a93f870 into react-component:master Feb 26, 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

2 participants