-
Notifications
You must be signed in to change notification settings - Fork 5
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
chore: add npm test ver #166
Conversation
Warning Rate limit exceeded@zombieJ has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 31 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. Walkthrough在此次更改中,新增了一个名为 Changes
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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
🧹 Outside diff range and nitpick comments (3)
.github/workflows/test-npm.yml (3)
1-3
: 建议优化工作流程名称以更好地反映其用途当前名称 "react component workflow" 过于笼统,建议修改为更具体的名称,例如 "npm test workflow" 或 "npm compatibility test",以便更清晰地表明这是一个专门用于 npm 测试的工作流程。
-name: react component workflow +name: npm compatibility test workflow
6-8
: 建议添加 Node.js 版本矩阵测试为确保在不同 Node.js 版本下的兼容性,建议添加版本矩阵测试。这对于验证包管理器行为特别重要。
jobs: react-component-workflow: name: react component workflow runs-on: ubuntu-latest + strategy: + matrix: + node-version: [16.x, 18.x, 20.x] steps: + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }}
13-19
: 建议保存测试结果和覆盖率报告当前配置已经包含了完整的测试流程,但建议添加步骤来保存测试结果和覆盖率报告作为工作流程构件,这样可以更方便地查看历史记录。
- run: npm run test -- --coverage - uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} + - name: Upload test results + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-results + path: | + coverage/ + test-results/
.github/workflows/test-npm.yml
Outdated
- uses: oven-sh/setup-bun@v2 | ||
- run: npm i --legacy-peer-deps |
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.
💡 Codebase verification
建议移除 Bun 设置并解决依赖问题
根据分析,发现以下问题:
- 代码库中没有任何 Bun 相关的配置或使用场景
- package.json 中存在 React 的对等依赖(peerDependencies)要求
>=16.9.0
- 项目直接依赖(dependencies)使用 React
^18.0.0
- 没有发现使用
--legacy-peer-deps
的必要性说明
建议修改:
- 移除不必要的 Bun 设置步骤
- 移除
--legacy-peer-deps
标志,因为项目的依赖版本要求是兼容的
- - uses: oven-sh/setup-bun@v2
- - run: npm i --legacy-peer-deps
+ - run: npm i
🔗 Analysis chain
验证 Bun 设置的必要性
既然这是一个专门用于 npm 测试的工作流程,建议移除 Bun 的设置步骤,除非有特殊需求。另外,使用 --legacy-peer-deps
标志可能会掩盖实际的依赖问题。
建议以下修改:
- 移除 Bun 设置
- 考虑移除
--legacy-peer-deps
标志,或添加说明注释解释其必要性
- - uses: oven-sh/setup-bun@v2
- - run: npm i --legacy-peer-deps
+ - run: npm i
运行以下脚本验证依赖关系:
Let me gather more information about potential Bun usage in the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# 检查 package.json 中的 peerDependencies
cat package.json | jq '.peerDependencies'
# 检查是否存在多个 React 版本声明
rg -g "package*.json" "\"react\": \".*\""
Length of output: 209
Script:
#!/bin/bash
# Check for Bun related configurations
rg -g "package*.json" "bun"
rg -g "*.yml" "bun"
# Check for any build or test scripts that might require Bun
cat package.json | jq '.scripts'
# Check if there are any specific comments about legacy-peer-deps necessity
rg -g "package*.json" "legacy-peer-deps"
rg -g "*.md" -i "legacy.?peer.?deps"
Length of output: 509
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.
不需要 bun 了吧
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.
@afc163,是的,我们不需要 Bun,可以移除相关的设置步骤。更新后的 .github/workflows/test-npm.yml
文件如下:
name: react component workflow
on: [workflow_call]
jobs:
react-component-workflow:
name: react component workflow
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run lint
- run: npx tsc --noEmit
- run: npm run compile
- run: npm run test -- --coverage
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
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.
bun 比 npm 快,其他 rc 库不涉及 React 19 的还能继续用着。
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.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
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.
这个 workflow 里没用到 bun。
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.
哦,我误会你的意思了。可以删
bun 在多版本下,会错误提升 React 版本。加个 npm 纯血版测试:
Summary by CodeRabbit
test-npm.yml
,用于测试 React 组件。