-
Notifications
You must be signed in to change notification settings - Fork 37
chore: package namespace #53
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
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 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. 📒 Files selected for processing (2)
Note Other AI code review bot(s) detectedCodeRabbit 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 分钟 Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
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. Comment |
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this 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.
"react": ">=18.0.0", | ||
"react-dom": ">=18.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this 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/overflowAlso 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
📒 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@^2
与father@^4
的兼容矩阵;若插件仅兼容 father3,需回退或升级插件。如需我检索官方说明可告知。
48-49
: 确认依赖已迁移至 @rc-component/*,无残留rc-resize-observer
或rc-util
导入,批准代码变更
"react": ">=18.0.0", | ||
"react-dom": ">=18.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Peer 要求 React>=18,但 devDependencies 仍为 React 16:版本不一致会导致本地/CI 构建与测试失配
- 当前 devDeps:
react@^16
、react-dom@^16
、@types/react@^16
、enzyme
/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.
Summary by CodeRabbit