Skip to content

Conversation

@EmilyyyLiu
Copy link
Contributor

@EmilyyyLiu EmilyyyLiu commented Oct 22, 2025

迁移到 @rc-component 空间

Summary by CodeRabbit

  • 杂务

    • 包名由 rc-overflow 改为 @rc-component/overflow,版本重置为 1.0.0,发布脚本与依赖项替换(clsx、@rc-component/resize-observer、@rc-component/util 等)。
    • CI 安装命令添加 --legacy-peer-deps。
  • 文档

    • README 与站点标题、徽章与安装说明更新为新包名。
  • 重构

    • 若干导入路径与类名拼接工具(classnames → clsx)替换,行为不变。
  • 测试

    • 测试依赖导入路径同步更新,测试逻辑无改动。

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Oct 22, 2025

Someone is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

@gemini-code-assist
Copy link

Summary of Changes

Hello @EmilyyyLiu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求的核心目标是将 rc-overflow 包迁移到 @rc-component 命名空间下。这包括更新包的名称、其依赖项以及相关的构建配置,以使其与新的组织结构保持一致。此更改旨在标准化 @rc-component 生态系统内的包命名和依赖管理。

Highlights

  • 包名迁移: 将包名从 rc-overflow 迁移到 @rc-component/overflow,这体现在 package.jsonREADME.mdtsconfig.json 文件中。
  • 依赖更新: 将 rc-utilrc-resize-observer 等依赖更新为它们在 @rc-component 命名空间下的对应版本,例如 rc-util 变为 @rc-component/util
  • 构建与发布脚本调整: 更新了 package.json 中的 prepublishOnly 脚本,改用 rc-np 进行发布流程,并移除了旧的 np 依赖。
  • 移除 Vercel 配置: 删除了 now.json 文件,该文件可能包含了 Vercel 部署相关的配置。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Oct 22, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

将包名与文档从 rc-overflow 迁移至 @rc-component/overflow,统一替换各处依赖导入源(rc-utilrc-resize-observer@rc-component/*),并用 clsx 代替 classnames;公共 API 与运行时逻辑未变(仅导入与包元数据/构建配置更新)。

Changes

凝聚体 / 文件(s) 变更摘要
包配置与文档
README.md, package.json, docs/index.md, .github/workflows/main.yml
包名由 rc-overflow@rc-component/overflowversion 更新,发布脚本由 nprc-np,README/徽章/说明同步替换引用;CI 中两处 npm 命令加入 --legacy-peer-deps
核心源码:导入与工具替换
src/Overflow.tsx, src/Item.tsx, src/RawItem.tsx, src/hooks/*
classnames 替换为 clsxclassNames(...)clsx(...));rc-resize-observer@rc-component/resize-observerrc-util 下的 hooks/raf/useEvent/useLayoutEffect 导入改为 @rc-component/util/...;代码逻辑与公有签名未变。
示例与测试导入更新
examples/fill-width.tsx, tests/github.spec.tsx
示例与测试中 useLayoutEffect、测试辅助与 observer util 的导入路径改为 @rc-component/*,测试断言与逻辑未改动。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 分钟

  • 重复性的导入路径和依赖替换,逻辑无实质改动。
  • 需重点复查:
    • package.json 中依赖替换、发布脚本(rc-np)与构建/打包配置是否兼容当前流程。
    • clsx 替换后所有 class 组合用法(特别是对象/数组/条件分支)是否保持预期输出。
    • @rc-component/* 导出路径与版本是否与原 rc-* 包接口一致(测试工具、内部 hook、raf、observerUtil 等)。

Poem

🐰 新名入耳闹清晨,包裹换了小花裙,
依赖悄迁不扰眠,clsx 轻拂旧字纹,
我在键上跳个圈,愿变更安然如春。

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 标题清晰准确地反映了主要变化:将包命名空间从 rc-overflow 迁移到 @rc-component/overflow。
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 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 ed003d1 and 9687dd7.

📒 Files selected for processing (1)
  • .github/workflows/main.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/main.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: compile
  • GitHub Check: lint
  • GitHub Check: coverage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request migrates the rc-overflow component to the @rc-component namespace. This involves updating the package name, dependencies, and import paths across multiple files. The changes appear to be straightforward namespace updates with version bumps. I have identified a potential issue with the version number in package.json and have raised a comment.

@EmilyyyLiu EmilyyyLiu force-pushed the migrate-rc-component branch from dd6168d to 142c9a1 Compare October 22, 2025 09:55
@yoyo837 yoyo837 mentioned this pull request Nov 25, 2025
@socket-security
Copy link

socket-security bot commented Nov 25, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​rc-component/​np@​1.0.4721006985100
Updated@​rc-component/​father-plugin@​1.1.0 ⏵ 2.1.379 -110079 +288 +1100
Addedclsx@​2.1.11001009680100
Added@​rc-component/​resize-observer@​1.0.1861008890100
Added@​rc-component/​util@​1.4.010010010093100

View full report

@afc163
Copy link
Member

afc163 commented Nov 25, 2025

README 里没改全

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

🧹 Nitpick comments (2)
.dumirc.ts (1)

11-13: 确认 GitHub Pages 实际访问路径是否匹配新的 base/publicPath

basepublicPath 在 GitHub Actions 环境下改为 /@rc-component/overflow/,实现与包名同路径;但仓库本身仍是 react-component/overflow,生成的 Pages 路径是否为该前缀需要再核对一下,以避免线上文档 404。

README.md (1)

10-23: npm / 下载 / bundle 大小等徽章链接已正确指向新作用域

npm 版本、下载量、bundlephobia 等链接均已切换到 @rc-component/overflow,与包名保持一致,GitHub 仓库相关链接维持 react-component/overflow 也符合当前仓库结构。

另外,16–19 行的 david-* 链接定义目前在文档中已经不再使用,可以顺便删除以消除 markdownlint 的 MD053 提示并减轻噪音。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fef9c44 and beffaea.

📒 Files selected for processing (6)
  • .dumirc.ts (1 hunks)
  • README.md (4 hunks)
  • docs/index.md (1 hunks)
  • src/Item.tsx (2 hunks)
  • src/Overflow.tsx (2 hunks)
  • src/RawItem.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/Overflow.tsx
  • src/RawItem.tsx
  • src/Item.tsx
🧰 Additional context used
🪛 LanguageTool
README.md

[grammar] ~57-~57: Ensure spelling is correct
Context: ...pm start ``` ## License @rc-component/overflowis released under the MIT license.

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🪛 markdownlint-cli2 (0.18.1)
README.md

16-16: Link and image reference definitions should be needed
Unused link or image reference definition: "david-url"

(MD053, link-image-reference-definitions)


17-17: Link and image reference definitions should be needed
Unused link or image reference definition: "david-image"

(MD053, link-image-reference-definitions)


18-18: Link and image reference definitions should be needed
Unused link or image reference definition: "david-dev-url"

(MD053, link-image-reference-definitions)


19-19: Link and image reference definitions should be needed
Unused link or image reference definition: "david-dev-image"

(MD053, link-image-reference-definitions)

🔇 Additional comments (4)
docs/index.md (1)

2-5: 文档站点标题与新包名保持一致,修改合理

hero.title 更新为 @rc-component/overflow 与本次迁移目标一致,其它配置无需调整。

.dumirc.ts (1)

6-9: dumi 站点名称已与新包名对齐

themeConfig.name 更新为 @rc-component/overflow,与包名保持一致,便于文档品牌统一。

README.md (2)

1-1: README 标题与包迁移一致

主标题已更新为 @rc-component/overflow,与本次迁移目标相符 👍。建议整体再快速全局搜一遍 rc-overflow / 旧 import,确保 README 里不再残留旧包名。


35-35: 安装说明徽章与 npm 包名一致

安装区的 nodei.co 徽章已更新为 @rc-component/overflow,与前面 npm 链接保持一致,迁移无误。

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dbff83e and 24c5ff3.

📒 Files selected for processing (1)
  • README.md (4 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
README.md

16-16: Link and image reference definitions should be needed
Unused link or image reference definition: "david-url"

(MD053, link-image-reference-definitions)


17-17: Link and image reference definitions should be needed
Unused link or image reference definition: "david-image"

(MD053, link-image-reference-definitions)


18-18: Link and image reference definitions should be needed
Unused link or image reference definition: "david-dev-url"

(MD053, link-image-reference-definitions)


19-19: Link and image reference definitions should be needed
Unused link or image reference definition: "david-dev-image"

(MD053, link-image-reference-definitions)

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

57-57: 许可证行拼写已正确

第 57 行 "@rc-component/overflow is released under the MIT license." 的拼写已正确修复,包名和动词之间有适当的空格。


1-1: 包名迁移已基本完成,但建议进一步验证完整性

@rc-component/overflow 的包名已在主要位置正确更新(标题、npm 链接、徽章、下载链接),符合命名空间迁移的要求。GitHub 仓库路径保留为原样(react-component/overflow)是正确的。

根据之前的反馈("README 里没改全"),建议验证:

  • 是否还有其他文档片段或示例代码中引用了旧的 rc-overflow 包名
  • 第 35 行的 nodei.co 安装徽章是否能正确显示新的包名

Also applies to: 10-13, 20-23, 35-35

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24c5ff3 and 2944af9.

📒 Files selected for processing (1)
  • package.json (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (3)
package.json (3)

2-3: 版本号从 1.4.1 降级到 1.0.0 是否有意为之?

版本从 1.4.1 直接降到 1.0.0,这在语义化版本体系中属于降级。虽然命名空间迁移可能需要重新计版本,但建议确认这是否为有意设计,还是应该升级到更高版本号(如 2.0.0)以反映 API 变更及命名空间迁移的重大性。


41-41: 验证 rc-np 发布工具的兼容性

prepublishOnly 脚本从 np --no-cleanup --yolo --no-publish 变更为 rc-np。请确认 @rc-component/np (1.0.3) 已正确集成且发布行为符合预期,特别是原脚本中的 --no-publish 标志的处理方式。


46-50: 验证依赖包 API 兼容性

dependencies 中的三个核心替换需要验证 API 兼容性:

  • classnamesclsx:已在代码中应用,API 大致兼容,但导出方式可能有差异
  • rc-resize-observer@rc-component/resize-observer
  • rc-util@rc-component/util

请确认所有源文件已正确更新导入路径,且新包的 API 与原包完全兼容。

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

🧹 Nitpick comments (1)
tests/setup.js (1)

49-57: 建议使用 queryByTestId 处理可选元素

findRestfindPrefixfindSuffix 方法使用 getByTestId,当元素不存在时会抛出异常。如果这些元素是可选的(某些测试场景下可能不存在),建议使用 queryByTestId 替代,返回 null 而不是抛出错误。

可以应用以下改动:

    findRest() {
-      return utils.getByTestId('overflow-item-rest');
+      return utils.queryByTestId('overflow-item-rest');
    },
    findPrefix() {
-      return utils.getByTestId('overflow-item-prefix');
+      return utils.queryByTestId('overflow-item-prefix');
    },
    findSuffix() {
-      return utils.getByTestId('overflow-item-suffix');
+      return utils.queryByTestId('overflow-item-suffix');
    }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4928cf3 and f7f24bb.

⛔ Files ignored due to path filters (4)
  • tests/__snapshots__/index.spec.tsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/invalidate.spec.tsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/raw.spec.tsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/ssr.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (7)
  • jest.config.js (1 hunks)
  • package.json (2 hunks)
  • tests/index.spec.tsx (4 hunks)
  • tests/invalidate.spec.tsx (4 hunks)
  • tests/raw.spec.tsx (5 hunks)
  • tests/setup.js (1 hunks)
  • tests/ssr.spec.tsx (1 hunks)
🧰 Additional context used
🪛 Biome (2.1.2)
tests/index.spec.tsx

[error] 76-76: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (8)
package.json (1)

2-3: 依赖迁移执行完整!

package.json 的更新与 PR 目标一致:

  • 包名正确迁移到 @rc-component/overflow
  • 依赖项正确替换为 @rc-component/* 命名空间和 clsx
  • React 和测试工具升级到 v18 和 RTL
  • 之前评审中提到的 enzyme 相关包已移除

Also applies to: 41-41, 47-49, 52-75

tests/ssr.spec.tsx (1)

2-2: SSR 测试迁移正确!

测试已成功从 Enzyme 迁移到 React Testing Library,导入更新正确。

jest.config.js (1)

2-2: Jest 配置更新正确!

移除了 Enzyme 的 snapshotSerializers 配置,与测试工具迁移一致。

tests/invalidate.spec.tsx (1)

1-1: 测试迁移实现正确!

已正确迁移到 React Testing Library,使用 container 进行快照断言是标准做法。

Also applies to: 19-20, 32-32, 36-37, 48-48

tests/raw.spec.tsx (1)

1-1: Raw 测试迁移完成!

测试已成功迁移到 RTL,DOM 查询和断言方式正确。

Also applies to: 21-22, 45-46, 49-54, 69-70, 82-82

tests/setup.js (1)

16-24: 验证 resize 触发机制的有效性

自定义的 triggerResizetriggerItemResize 方法通过 fireEvent 触发自定义 resize 事件,但 ResizeObserver 并不监听 DOM 的 resize 事件,而是有自己的内部机制。查看 tests/index.spec.tsx 发现 ResizeObserver 被完全 mock 了,这些辅助方法可能无法正确触发组件的 resize 行为。

请确认这些方法是否能正确触发组件的响应式布局逻辑,或者是否需要调整 mock 策略来配合这些辅助方法。

Also applies to: 25-34

tests/index.spec.tsx (2)

15-35: 测试基础设施迁移完成!

ResizeObserver mock 设置和清理逻辑正确,测试用例已成功迁移到 RTL 模式,使用 DOM 查询和断言方式符合 RTL 最佳实践。

Also applies to: 45-72


74-81: 其他测试用例迁移正确!

renderItemrenderRestcustomize component 等测试用例已正确迁移到 RTL,使用 container 查询和 screen API 符合最佳实践。

Also applies to: 83-98, 100-127, 155-167

@afc163
Copy link
Member

afc163 commented Dec 1, 2025

ci 挂了

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the rc-overflow package to the @rc-component namespace, updating the package name to @rc-component/overflow and resetting the version to 1.0.0. The migration includes updating all dependencies, imports, and documentation to use the new namespace, and modernizing the test infrastructure from Enzyme to React Testing Library.

  • Migrates package namespace from rc-overflow to @rc-component/overflow
  • Updates all dependencies to use @rc-component scoped packages (@rc-component/util, @rc-component/resize-observer) and replaces classnames with clsx
  • Modernizes test infrastructure by migrating from Enzyme to React Testing Library with custom test utilities

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
package.json Updates package name to @rc-component/overflow, resets version to 1.0.0, updates dependencies to @rc-component namespace packages, upgrades React/testing-library versions
tsconfig.json Updates TypeScript path mapping from rc-overflow to @rc-component/overflow
src/hooks/useEffectState.tsx Migrates useEvent import from rc-util to @rc-component/util
src/hooks/channelUpdate.ts Updates raf import to use @rc-component/util
src/RawItem.tsx Replaces classnames with clsx for className composition
src/Overflow.tsx Updates imports: classnamesclsx, rc-resize-observer@rc-component/resize-observer, rc-util@rc-component/util
src/Item.tsx Replaces classnames with clsx and updates rc-resize-observer import
tests/setup.js Complete rewrite from Enzyme adapter to React Testing Library with custom render utilities and ResizeObserver mocking
tests/ssr.spec.tsx Updates test import from Enzyme to React Testing Library
tests/raw.spec.tsx Migrates from Enzyme's mount to React Testing Library's render
tests/invalidate.spec.tsx Migrates from Enzyme to React Testing Library
tests/index.spec.tsx Comprehensive migration to React Testing Library with ResizeObserver mocks, updated assertions, and commented-out key tests
tests/github.spec.tsx Updates imports to use @rc-component namespace packages
tests/snapshots/*.snap Regenerated snapshots for React Testing Library output format
examples/fill-width.tsx Updates useLayoutEffect import to @rc-component/util
docs/index.md Updates title from rc-overflow to @rc-component/overflow
README.md Updates package name, badges, and install instructions for scoped package
.dumirc.ts Updates theme name and GitHub Pages paths for scoped package
jest.config.js Removes Enzyme-specific snapshot serializer configuration
now.json Removes Vercel deployment configuration file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 23 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yoyo837 yoyo837 force-pushed the migrate-rc-component branch from f7f24bb to d59a97b Compare December 3, 2025 14:37
@socket-security
Copy link

socket-security bot commented Dec 3, 2025

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@yoyo837
Copy link
Member

yoyo837 commented Dec 3, 2025

@EmilyyyLiu 看着一大堆 test case 需要迁移到 jest,贡献者可能难以抽出一整片的时间来迁移,先保证包切换成功,后面慢慢来处理吧。

@afc163 @zombieJ 如何?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@afc163 afc163 merged commit 6efcec0 into react-component:master Dec 4, 2025
14 of 15 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.

4 participants