Skip to content
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: pnpm => bun #11358

Merged
merged 8 commits into from
Oct 9, 2024
Merged

chore: pnpm => bun #11358

merged 8 commits into from
Oct 9, 2024

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Oct 9, 2024

Summary by CodeRabbit

  • 新特性

    • 更新了多个工作流配置,以提高持续集成和代码质量检查的效率。
    • 引入了 Bun 作为新的 JavaScript 运行时,替代 npm 进行依赖管理和构建。
  • 依赖更新

    • 更新了多个依赖包的版本,以增强项目的稳定性和功能。
  • 样式

    • 统一了 YAML 配置文件中的字符串格式,提升了代码的一致性和可读性。

Copy link

coderabbitai bot commented Oct 9, 2024

Caution

Review failed

The head commit changed during the review from 17b051e to 52eae6d.

Walkthrough

此拉取请求包含对多个配置文件的修改,主要集中在GitHub工作流和依赖管理上。.github/dependabot.yml文件中,字符串定界符从双引号更改为单引号,以增强一致性。.github/workflows/ci.yml文件更新了工作流名称并将构建步骤从使用npm更改为使用Bun。.github/workflows/codeql.yml文件也进行了字符串格式化的调整。.github/workflows/pnpm.yml文件更新了Node.js版本及相关操作。最后,package.json文件中更新了多个依赖项的版本。

Changes

文件路径 更改摘要
.github/dependabot.yml 字符串定界符从双引号改为单引号,package-ecosysteminterval字段更新。
.github/workflows/ci.yml 工作流名称更改为“CI”,构建步骤从npm更改为Bun,新增使用oven-sh/setup-bun@v2的步骤。
.github/workflows/codeql.yml 字符串和数组声明的格式化调整,双引号更改为单引号,数组声明格式化。
.github/workflows/pnpm.yml Node.js版本更新至20,checkout和setup-node操作更新至版本4,pnpm安装方式更改。
.lintstagedrc 具体化lint-staged文件模式,替换通配符为特定文件类型模式。
package.json 更新多个依赖项的版本,移除lint-staged配置块。

Possibly related PRs

  • chore: prettier code, lint, test case #11323: 此PR涉及对.github/workflows/ci.yml文件的修改,也包括类似于.github/dependabot.yml文件的风格更新。两个PR都专注于增强YAML配置文件的一致性。

🐰 在兔子洞中,配置更新真欢喜,
字符串格式更一致,工作流更流畅无比。
Bun来助力,npm不再,
依赖版本新,项目更精彩!
兔子跳跃,欢声笑语,
代码世界,永远在前行。 🌟


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 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.

Copy link

github-actions bot commented Oct 9, 2024

🎊 PR Preview has been successfully built and deployed to https://ant-design-pro-preview-pr-11358.surge.sh

.github/workflows/pnpm.yml Outdated Show resolved Hide resolved
Copy link

socket-security bot commented Oct 9, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@ant-design/pro-components@2.7.19 Transitive: environment, eval +54 27.4 MB chenshuai2144
npm/@commitlint/cli@19.5.0 Transitive: environment, eval, filesystem, shell, unsafe +69 6.65 MB bycedric, escapedcat, marionebl, ...1 more
npm/@commitlint/config-conventional@19.5.0 Transitive: filesystem +5 2.42 MB bycedric, escapedcat, marionebl, ...1 more
npm/@types/jest@29.5.13 Transitive: environment +5 758 kB types
npm/@types/lodash@4.17.10 None 0 867 kB types
npm/@types/react@18.3.11 None +2 1.69 MB types
npm/@umijs/lint@4.3.24 shell Transitive: environment, eval, filesystem, network, unsafe +163 47.6 MB yifankakaxi
npm/@umijs/max@4.3.24 Transitive: environment, eval, filesystem, network, shell, unsafe +241 148 MB yifankakaxi
npm/antd-style@3.7.0 environment +9 2.43 MB arvinxx
npm/antd@5.21.2 environment +58 64.6 MB chenshuai2144
npm/eslint@8.57.1 environment, filesystem Transitive: eval, shell, unsafe +59 9.68 MB eslintbot
npm/express@4.21.1 Transitive: environment +2 314 kB blakeembrey, dougwilson, linusu, ...4 more
npm/gh-pages@3.2.3 filesystem, shell +11 426 kB tschaub
npm/husky@9.1.6 environment, filesystem, shell 0 4.03 kB typicode
npm/jest-environment-jsdom@29.7.0 None +2 2.35 MB simenb
npm/jest@29.7.0 None 0 5.01 kB simenb
npm/lint-staged@15.2.10 Transitive: environment, filesystem, shell +5 748 kB okonet
npm/mockjs@1.1.0 None 0 1.89 MB alvarto
npm/prettier@3.3.3 environment, filesystem, unsafe 0 7.7 MB prettier-bot
npm/querystring@0.2.1 None 0 9.39 kB medikoo
npm/react-dev-inspector@1.9.0 network Transitive: environment, filesystem +39 9.96 MB zthxxx
npm/react-dom@18.3.1 environment +2 4.53 MB react-bot
npm/react@18.3.1 environment +2 339 kB react-bot
npm/swagger-ui-dist@4.19.1 network 0 8.65 MB swagger-api
npm/ts-node@10.9.2 environment, filesystem, unsafe +3 3.63 MB blakeembrey
npm/typescript@5.6.3 None 0 22.4 MB andrewbranch, minestarks, rbuckton, ...5 more
npm/umi-presets-pro@2.0.3 Transitive: environment, eval, filesystem, network, shell, unsafe +107 78.9 MB chenshuai2144
npm/umi-serve@1.9.11 Transitive: environment, filesystem, network +55 11.7 MB sorrycc

🚮 Removed packages: npm/@types/jest@29.5.12, npm/@types/lodash@4.17.7, npm/@types/react@18.3.4, npm/@umijs/max@4.3.18, npm/antd-style@3.6.2, npm/antd@5.20.3

View full report↗︎

.github/workflows/pnpm.yml Outdated Show resolved Hide resolved
@afc163 afc163 changed the title chore: upgrade workflows version chore: upgrade pnpm version and enable bun install Oct 9, 2024
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

🧹 Outside diff range and nitpick comments (5)
.lintstagedrc (3)

2-2: 良好的改进,建议小幅优化

这个更改很好地将 lint 任务限定在了 JavaScript 和 TypeScript 文件上。使用自定义的 npm 脚本 lint-staged:js 提供了更大的灵活性。

考虑使用 pnpmbun 来替代 npm,以保持与 PR 目标的一致性。例如:

"**/*.{js,jsx,ts,tsx}": "pnpm run lint-staged:js",

3-5: 配置合理,建议考虑文件类型顺序

这个配置很好地覆盖了多种文件类型,使用 Prettier 进行格式化是一个很好的做法。使用数组来配置命令也为未来可能的扩展提供了便利。

建议按照字母顺序排列文件扩展名,以提高可读性:

"**/*.{js,jsx,json,less,md,ts,tsx,yml}": [
  "prettier --write"
]

1-5: 总体改进显著,建议进一步优化

这些更改显著提高了 lint-staged 配置的精确性和有效性。通过分离 JavaScript/TypeScript 文件的 lint 任务和其他文件类型的格式化任务,可以更好地控制代码质量和一致性。

建议考虑以下优化:

  1. 使用 pnpmbun 替代 npm 以与 PR 目标保持一致。
  2. 按字母顺序排列文件扩展名以提高可读性。

这些小改动将进一步提升配置的质量和可维护性。

.github/workflows/ci.yml (1)

1-1: 工作流名称更改已批准,但建议添加描述

工作流名称的更改使其更加简洁。然而,为了提高清晰度,建议在工作流文件的顶部添加一个简短的描述,说明此CI工作流的具体用途。

您可以考虑在文件顶部添加如下注释:

# 此CI工作流用于验证Node.js项目的构建、lint和类型检查
.github/workflows/pnpm.yml (1)

22-24: pnpm 设置操作添加获得批准

添加 pnpm/action-setup 操作是一个很好的改进,它提供了一种更可靠的方式来设置 pnpm。使用版本 9 也是一个不错的选择。

建议:考虑使用最新的 pnpm 主要版本(目前是 8.x)以获得最新的功能和性能改进。您可以将版本设置为 8 来始终使用最新的 8.x 版本。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0946731 and 86e59ba.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • .github/dependabot.yml (1 hunks)
  • .github/workflows/ci.yml (2 hunks)
  • .github/workflows/codeql.yml (3 hunks)
  • .github/workflows/pnpm.yml (1 hunks)
  • .lintstagedrc (1 hunks)
  • package.json (3 hunks)
✅ Files skipped from review due to trivial changes (2)
  • .github/dependabot.yml
  • .github/workflows/codeql.yml
🧰 Additional context used
🔇 Additional comments (9)
.github/workflows/ci.yml (1)

23-26: npm/yarn命令已成功替换为Bun命令

所有的npm/yarn命令都已一致地替换为相应的Bun命令,这与添加Bun设置步骤的决定相符。这种变化可能会提高构建过程的效率。

为确保兼容性和正确性,请验证项目的package.json文件中定义的脚本是否与这些Bun命令兼容。运行以下脚本来检查:

#!/bin/bash
# 描述:验证package.json中的脚本与CI工作流中使用的Bun命令是否匹配

# 测试:提取package.json中的相关脚本
echo "package.json中的相关脚本:"
jq '.scripts | {lint, tsc, build}' package.json

# 测试:检查是否有任何脚本仍然使用npm或yarn
echo "检查是否有脚本仍使用npm或yarn:"
jq '.scripts[]' package.json | rg 'npm|yarn'

根据脚本结果,请确保:

  1. package.json中定义了linttscbuild脚本。
  2. 这些脚本与CI工作流中使用的Bun命令兼容。
  3. 没有遗漏任何需要从npm/yarn迁移到Bun的脚本。
.github/workflows/pnpm.yml (3)

13-13: Node.js 版本更新已批准

将 Node.js 版本更新到 20 是一个很好的做法,这与使用最新的 LTS 版本保持一致。


16-16: checkout 操作版本更新获得批准

将 checkout 操作更新到 v4 是一个很好的改进。这有助于确保您使用最新的功能和安全修复。


18-18: setup-node 操作版本更新已批准

将 setup-node 操作更新到 v4 是一个很好的改进,与使用最新主要版本的最佳实践保持一致。

package.json (5)

46-46: antd-style 版本更新已批准

antd-style 的版本从 ^3.6.2 更新到 ^3.7.0 是一个小版本更新。这种更新通常包含新功能或非破坏性更改。

建议查看 antd-style 的更新日志,了解此次更新中的具体变化:

#!/bin/bash
echo "请访问以下链接查看 antd-style 的更新日志:"
echo "https://github.com/ant-design/antd-style/blob/master/CHANGELOG.md"

Line range hint 61-82: 开发依赖更新总结

多个开发依赖项已更新,主要是小版本更新。这些更改包括:

  • @types/jest: ^29.5.12 → ^29.5.13
  • @types/lodash: ^4.17.4 → ^4.17.10
  • @types/react: ^18.3.3 → ^18.3.11
  • @umijs/lint: ^4.2.9 → ^4.3.24
  • @umijs/max: ^4.2.9 → ^4.3.24
  • eslint: ^8.57.0 → ^8.57.1
  • express: ^4.19.2 → ^4.21.1
  • typescript: ^5.4.5 → ^5.6.3

建议采取以下措施:

  1. 验证开发环境是否与这些更新兼容。
  2. 检查 CI/CD 管道,确保它们能够正常运行。
  3. 运行所有测试,确保没有引入新的问题。

请执行以下命令来验证开发环境:

#!/bin/bash
echo "正在验证开发环境..."
npm install
npm run build
npm test

如果以上命令执行无误,则开发环境大概率与新版本兼容。


43-43: @ant-design/pro-components 版本更新已批准

@ant-design/pro-components 的版本从 ^2.7.9 更新到 ^2.7.19 是一个小版本更新。这种更新通常包含新功能或非破坏性更改。

建议查看 @ant-design/pro-components 的更新日志,了解此次更新中的具体变化:


Line range hint 1-116: package.json 更新总结

本次更新主要涉及依赖项的版本升级,包括生产依赖和开发依赖。总体来说,这些更改属于低风险更新,但仍需注意以下几点:

  1. 核心依赖 @ant-design/pro-components 和 antd 的更新可能引入新特性或改进,建议仔细阅读其更新日志。
  2. 开发依赖的更新可能影响开发和构建过程,确保您的开发环境和 CI/CD 流程与新版本兼容。

为确保更新不会引入问题,建议:

  1. 全面测试应用程序,特别关注使用了 antd 和 @ant-design/pro-components 的部分。
  2. 检查构建输出,确保没有新的警告或错误。
  3. 在开发环境中进行充分的测试和验证。

执行以下命令来验证更新后的项目状态:

如果所有命令都成功执行,那么这次依赖更新很可能是安全的。但仍然建议在合并到主分支之前,在预生产环境中进行全面测试。


45-45: antd 版本更新已批准,但需要额外注意

antd 的版本从 ^5.18.0 更新到 ^5.21.2 是一个较大的小版本更新。这可能引入了新功能或重要改进。

由于版本跨度较大,强烈建议:

  1. 仔细阅读 antd 的更新日志,了解新特性和可能的变更。
  2. 全面测试应用程序,确保与新版本 antd 兼容。

请运行以下命令查看详细的更新日志:

✅ Verification successful

已验证 antd 版本更新

package.json 中 antd 的版本已成功更新到 ^5.21.2。建议进行全面测试以确保与新版本兼容。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
echo "请访问以下链接查看 antd 的更新日志:"
echo "https://github.com/ant-design/ant-design/blob/master/CHANGELOG.en-US.md"

Length of output: 678


Script:

#!/bin/bash
# 检查 package.json 中 antd 的版本

jq '.dependencies.antd' package.json

Length of output: 46

- run: yarn run lint
- run: yarn run tsc
- run: yarn run build
- uses: oven-sh/setup-bun@v2
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

发现Bun设置与现有Node.js环境存在不一致

.github/workflows/ci.yml 中添加了 Bun 设置步骤,但 package.json 中的脚本仍然使用 npm 和 yarn。建议:

  • 确认是否所有脚本已经迁移到使用 Bun。
  • 如果计划继续使用 Bun,考虑移除 Node.js 的设置步骤以避免环境冲突。
  • 如果暂时不使用 Bun,移除相关的设置步骤以保持配置一致性。
🔗 Analysis chain

Bun设置步骤已添加,但需要澄清与Node.js的关系

添加Bun设置步骤表明项目正在转向使用Bun作为构建工具。这是一个积极的改变,可能会提高构建性能。

然而,工作流仍然设置了Node.js环境。建议澄清是否仍然需要Node.js设置,以及Bun和Node.js环境如何协同工作。请运行以下脚本来验证项目中Bun的使用情况:

根据脚本结果,请考虑以下问题:

  1. 是否所有脚本都已更新为使用Bun?
  2. 是否仍有依赖项需要Node.js?
  3. 是否可以完全移除Node.js设置步骤?
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:验证项目中Bun的使用情况

# 测试:搜索package.json中的Bun相关配置
echo "检查package.json中的Bun配置:"
jq '.scripts, .dependencies, .devDependencies' package.json

# 测试:搜索项目中可能使用Bun的其他配置文件
echo "检查其他可能使用Bun的配置文件:"
fd -e json -e js -e ts -e yaml -e yml | xargs rg 'bun'

Length of output: 733

@afc163 afc163 changed the title chore: upgrade pnpm version and enable bun install chore: pnpm => bun Oct 9, 2024
@afc163 afc163 merged commit c971df4 into master Oct 9, 2024
22 checks passed
@afc163 afc163 deleted the chore/upgrade-github-actions-2 branch October 9, 2024 03:35
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