Skip to content

Conversation

yoyo837
Copy link
Member

@yoyo837 yoyo837 commented Sep 29, 2025

Summary by CodeRabbit

  • 文档
    • 将项目与包名更新为 @rc-component/overflow;README 徽章、安装说明与文档首页标题同步更新。
  • 杂务
    • 重命名包并更新发布流程;站点基础路径改为 /@rc-component/overflow/。
    • 依赖迁移至 @rc-component 生态。
    • 提升对等依赖要求:React/ReactDOM ≥ 18(可能引入不兼容变更)。
    • 移除旧 Vercel 部署配置。
  • 测试
    • 更新测试依赖与导入路径,功能不变。

Copy link

vercel bot commented Sep 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
overflow Ready Ready Preview Comment Sep 29, 2025 2:39am

Copy link

coderabbitai bot commented Sep 29, 2025

Warning

Rate limit exceeded

@yoyo837 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6570ab3 and 7fd718d.

📒 Files selected for processing (2)
  • .github/workflows/main.yml (5 hunks)
  • package.json (2 hunks)

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-* 切换至 @rc-component/*;移除 Vercel 部署配置;调整 React 同行依赖至 >=18。

Changes

Cohort / File(s) Summary
包重命名与文档
README.md, docs/index.md
文档与徽章由 rc-overflow 更新为 @rc-component/overflow;文档首页 hero 标题同步更新。
站点与构建配置
.dumirc.ts, package.json, tsconfig.json
.dumirc.ts 中 themeConfig.name、base、publicPath 改为 @rc-component/overflow;package.json 更名、版本重置、脚本由 np 改为 rc-np,依赖切换至 @rc-component/*,peerDependencies 要求 React/DOM >=18;tsconfig 路径别名改为 @rc-component/overflow。
源码导入切换(@rc-component
src/Overflow.tsx, src/Item.tsx, src/hooks/channelUpdate.ts, src/hooks/useEffectState.tsx
将 ResizeObserver、useLayoutEffect、raf、useEvent 的导入路径从 rc-* 替换为 @rc-component/*;逻辑不变。
示例同步
examples/fill-width.tsx
useLayoutEffect 导入改为 @rc-component/util 路径。
测试同步
tests/github.spec.tsx
测试辅助方法与工具导入由 rc-* 改为 @rc-component/*。
移除部署配置
now.json
删除 Vercel v2 部署配置文件。

Estimated code review effort

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

Poem

小兔挥笔改名牌,包名一跃至新台;
引用路径皆整齐,@rc-component 生色来。
旧舟 now.json 轻别离,
React 十八伴我开。
啪嗒啪嗒,发布踏云迈。

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
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.
Title Check ❓ Inconclusive 该标题“chore: package namespace”过于通用,未能清晰描述具体更改内容,也未指出目标命名空间或关键变更范围,因此无法准确传达此次PR的主要目的。 建议将标题修改为更具体的表达,例如“chore: 将包重命名为 @rc-component/overflow 并更新导入路径”,以便团队成员快速了解此次主要变更。
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

Summary of Changes

Hello @yoyo837, 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!

This pull request undertakes a significant refactoring effort by migrating the rc-overflow package to the new @rc-component/overflow namespace. This change standardizes the package's naming convention and involves updating all internal references, documentation, and build configurations to reflect the new name. Concurrently, the project's dependencies on rc-util and rc-resize-observer have been updated to their respective @rc-component scoped versions, and the peer dependencies for React have been bumped to React 18, ensuring modern compatibility. The removal of the now.json file also suggests an adjustment in deployment or build tooling.

Highlights

  • Package Namespace Migration: The core rc-overflow package has been renamed to @rc-component/overflow to align with a new organizational namespace.
  • Dependency Updates: All internal rc-util and rc-resize-observer dependencies have been updated to their new scoped @rc-component equivalents.
  • React 18 Compatibility: The project's peer dependencies have been upgraded to require React 18, ensuring compatibility with the latest React ecosystem.
  • Build & Documentation Alignment: Configuration files (.dumirc.ts, tsconfig.json) and documentation (README.md, docs/index.md) have been updated to reflect the new package name and paths.
  • Vercel Configuration Removal: The now.json file, likely related to Vercel deployment, has been removed.
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.

Copy link

socket-security bot commented Sep 29, 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.4701006684100
Updated@​types/​react-dom@​16.9.25 ⏵ 18.3.7100 +110076 +190100
Updated@​rc-component/​father-plugin@​1.1.0 ⏵ 2.1.382 +310077 +187100
Added@​types/​react@​18.3.241001007996100
Added@​rc-component/​resize-observer@​1.0.0931008883100
Added@​rc-component/​util@​1.3.010010010090100

View full report

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

This pull request primarily handles the renaming of the package from rc-overflow to the namespaced @rc-component/overflow. The changes are applied consistently across configuration files, documentation, and source code. A significant change is the upgrade of the peerDependencies to require React 18, making this a breaking change. While this is a valid step for a new major version, I've found a critical issue where the development dependencies have not been updated to match this new requirement, which will likely break the development and testing environment.

Comment on lines +79 to +80
"react": ">=18.0.0",
"react-dom": ">=18.0.0"

Choose a reason for hiding this comment

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

critical

Bumping the peerDependencies to require React 18 is a major breaking change. However, the project's devDependencies have not been updated accordingly. For instance, react is still ^16.0.0, and enzyme-adapter-react-16 is used, while Enzyme doesn't have a stable adapter for React 18. This inconsistency will cause issues with the local development setup and testing. To ensure the project is buildable and testable, devDependencies should be updated to be compatible with React 18.

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 (5)
examples/fill-width.tsx (1)

2-2: useLayoutEffect 路径迁移无问题;建议小幅增强 TS 严格模式兼容性

当前对 ref 的使用在严格模式下可能提示可空值访问。可选:

  • 使用可选链或非空断言以消噪并提高健壮性。
@@
-  useLayoutEffect(() => {
-    setInputWidth(measureRef.current.offsetWidth);
-  }, [inputValue]);
+  useLayoutEffect(() => {
+    setInputWidth(measureRef.current?.offsetWidth ?? 0);
+  }, [inputValue]);
@@
-  React.useEffect(() => {
-    inputRef.current.focus();
-  }, []);
+  React.useEffect(() => {
+    inputRef.current?.focus();
+  }, []);
README.md (1)

1-1: 文档已重命名到 scoped 包;建议完善安装指引并改用 HTTPS

  • 将 npm/bundlephobia 徽章与链接统一为 HTTPS,避免混合内容与重定向。
  • david-dm 服务已停止,建议移除相关徽章,减少 404。
  • 在 Install 区块补充命令示例,降低接入摩擦。

示例变更(片段):

- [npm-image]: http://img.shields.io/npm/v/@rc-component/overflow.svg?style=flat-square
- [npm-url]: http://npmjs.org/package/@rc-component/overflow
+ [npm-image]: https://img.shields.io/npm/v/@rc-component/overflow.svg?style=flat-square
+ [npm-url]: https://www.npmjs.com/package/@rc-component/overflow
- [bundlephobia-url]: https://bundlephobia.com/result?p=@rc-component/overflow
- [bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/overflow
+ [bundlephobia-url]: https://bundlephobia.com/result?p=@rc-component/overflow
+ [bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/overflow

补充安装指引(新增):

npm i @rc-component/overflow
# 
yarn add @rc-component/overflow
# 
pnpm add @rc-component/overflow

Also applies to: 10-11, 20-23, 35-35, 57-57

tsconfig.json (1)

13-13: 建议临时保留 “rc-overflow” 兼容映射,内部未检测到模块导入

已确认代码库中不存在对 "rc-overflow" 的模块导入(仅作为 CSS class 前缀和测试选择器出现),可在 tsconfig.json 的 paths 中新增:

   "@rc-component/overflow": ["src/index.tsx"],
+  "rc-overflow":             ["src/index.tsx"]

以便示例/外部项目平滑迁移,1~2 个小版本后移除该兼容映射。

package.json (2)

2-3: 包名切换 + 版本重置:补充发布配置与迁移告知

  • Scoped 包默认私有。为避免首次发布变成私有包,建议补充 "publishConfig": { "access": "public" },或确认发布工具已强制 --access public
  • 请在旧包 rc-overflow 上执行 npm deprecate 并在 README/CHANGELOG 标注迁移路径,确保 latest dist-tag 指向新包。

建议补丁(位置可放在顶层任意处):

 {
   "name": "@rc-component/overflow",
   "version": "1.0.0",
+  "publishConfig": {
+    "access": "public"
+  },
   "description": "Auto collapse box when overflow",

31-45: 脚本清理与类型/打包元数据小优化(可选)

  • 已移除 Vercel 配置但仍保留 "now-build",建议删除以免混淆。
  • 建议补充 "types" 指向构建产物的 d.ts(需与 father 的声明输出路径一致)。
  • 可选:补充 "sideEffects": ["*.less","*.css"],利于 tree-shaking 同时保留样式副作用。

建议补丁(请根据实际产物路径调整 types):

   "scripts": {
     "lint:tsc": "tsc -p tsconfig.json --noEmit",
-    "now-build": "npm run docs:build"
+    "now-build": "npm run docs:build"
   },
+  "types": "./es/index.d.ts",
+  "sideEffects": [
+    "*.less",
+    "*.css"
+  ],
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b000f1 and 6570ab3.

📒 Files selected for processing (12)
  • .dumirc.ts (1 hunks)
  • README.md (5 hunks)
  • docs/index.md (1 hunks)
  • examples/fill-width.tsx (1 hunks)
  • now.json (0 hunks)
  • package.json (3 hunks)
  • src/Item.tsx (1 hunks)
  • src/Overflow.tsx (1 hunks)
  • src/hooks/channelUpdate.ts (1 hunks)
  • src/hooks/useEffectState.tsx (1 hunks)
  • tests/github.spec.tsx (1 hunks)
  • tsconfig.json (1 hunks)
💤 Files with no reviewable changes (1)
  • now.json
🔇 Additional comments (11)
src/hooks/channelUpdate.ts (1)

1-1: raf 导入来源替换为 @rc-component/util,行为等价

仅命名空间迁移,无语义变化;MessageChannel 不可用时退回 raf 的策略保持不变。

tests/github.spec.tsx (1)

3-3: 测试导入路径及依赖版本验证通过
已确认所有测试导入均指向 @rc-component/*,且 package.json 中 devDependencies 包含 @rc-component/util@^1.3.0@rc-component/resize-observer@^1.0.0,无需额外操作。

docs/index.md (1)

3-3: 确认无残留 rc-overflow 文案 已确认所有出现仅限于 CSS 类名和代码中 default prefixCls,文档/配置无需进一步修改。

src/hooks/useEffectState.tsx (1)

1-1: useEvent 导入路径已正确更新
仓库中不再引用旧路径 rc-util/lib/hooks/useEvent,迁移已完成。

.dumirc.ts (2)

7-7: 站点名称变更 OK

展示名称切换到 scoped 包名无问题。


12-13: 请先设置 GITHUB_REPOSITORY 并构建后验证 docs-dist 资源前缀

本地环境未设置 GITHUB_REPOSITORY 且未生成 docs-dist,脚本无法校验资源前缀。请按以下步骤操作:

  • 在 CI 或本地执行
    export GITHUB_REPOSITORY=org/overflow
    npm run build
    生成 docs-dist
  • 再运行校验脚本:
    rg -nP "href=['\"]/(/overflow)/" docs-dist \
      || echo "资源前缀不匹配,请检查 base/publicPath 配置"

推荐可选修复:使用 !!process.env.GITHUB_ACTIONS 强制布尔并动态派生 repo,替换硬编码前缀:

- const isGitPagesSite = process.env.GITHUB_ACTIONS;
+ const isGitPagesSite = !!process.env.GITHUB_ACTIONS;
+ const repo = process.env.GITHUB_REPOSITORY?.split('/')[1] || 'overflow';

 export default defineConfig({
   ...
-  base: isGitPagesSite ? `/@rc-component/overflow/` : `/`,
-  publicPath: isGitPagesSite ? `/@rc-component/overflow/` : `/`,
+  base: isGitPagesSite ? `/${repo}/` : `/`,
+  publicPath: isGitPagesSite ? `/${repo}/` : `/`,
})
src/Overflow.tsx (1)

4-5: 依赖校验通过,导入升级完成
已确认无 rc-util 残留,package.json 已声明 @rc-component/util@rc-component/resize-observer,且 peerDependencies.react >=18.0.0

src/Item.tsx (1)

3-3: ResizeObserver 导入切换验证通过

已确认 package.json 仅存在新包 @rc-component/resize-observer,且代码中未检索到任何对旧包 rc-resize-observer 的引用。合并无误。

package.json (3)

41-41: 发布脚本改为 rc-np:请确认行为一致

确认 rc-np 会:

  • 以 public 访问级别发布 scoped 包;
  • 推送 tag / 生成变更记录;
  • 在 CI 中使用只读 NPM_TOKEN + 2FA/automation 流程。

rc-np 不强制 public,需保留上文的 publishConfig.access=public 兜底。


52-53: 构建链路版本匹配

请确认 @rc-component/father-plugin@^2father@^4 的兼容矩阵;若插件仅兼容 father3,需回退或升级插件。

如需我检索官方说明可告知。


48-49: 确认依赖已迁移至 @rc-component/*,无残留 rc-resize-observerrc-util 导入,批准代码变更

Comment on lines +79 to +80
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Peer 要求 React>=18,但 devDependencies 仍为 React 16:版本不一致会导致本地/CI 构建与测试失配

  • 当前 devDeps:react@^16react-dom@^16@types/react@^16enzyme/enzyme-adapter-react-16 等均与 React 18 不匹配,极易在类型与测试层面报错。
  • 建议方案A(推荐):将 devDeps 升级到 React 18,并迁移测试至 RTL(enzyme 对 React 18 支持不完善)。

参考补丁(最小对齐,版本号可按你们实际约束调整):

   "devDependencies": {
-    "@testing-library/jest-dom": "^5.16.4",
-    "@testing-library/react": "^12.0.0",
-    "@types/react": "^16.14.2",
-    "@types/react-dom": "^16.9.10",
+    "@testing-library/jest-dom": "^6.0.0",
+    "@testing-library/react": "^14.0.0",
+    "@types/react": "^18.0.0",
+    "@types/react-dom": "^18.0.0",
-    "enzyme": "^3.0.0",
-    "enzyme-adapter-react-16": "^1.0.1",
-    "enzyme-to-json": "^3.4.0",
+    // 如仍保留 enzyme,请明确兼容策略;更建议移除并统一使用 RTL
-    "react": "^16.0.0",
-    "react-dom": "^16.0.0",
+    "react": "^18.0.0",
+    "react-dom": "^18.0.0",

若短期无法迁移测试,可临时放宽 peer 到 >=16.9.0,但这与本 PR 目标相悖,不建议。

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In package.json around lines 79-80, peerDependencies require "react" and
"react-dom" >=18 but devDependencies still use React 16 and enzyme (mismatched
versions will break local/CI builds and tests); update devDependencies to align
with React 18 by bumping "react", "react-dom", and "@types/react" to compatible
^18 versions, remove or replace enzyme/enzyme-adapter-react-16 with
testing-library/react and related RTL tooling, update test setup files and
adapters to RTL (or if absolutely necessary as a short-term stopgap only, relax
the peer to ">=16.9.0" temporarily), and run/adjust tests to fix any API/type
changes introduced by React 18 and the new testing library.

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.

1 participant