Skip to content

Node20 #17727

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Node20 #17727

wants to merge 3 commits into from

Conversation

ianzone
Copy link
Contributor

@ianzone ianzone commented May 17, 2025

这个 PR 做了什么? (简要描述所做更改)
弃用 node18,默认以 node20 构建

这个 PR 是什么类型? (至少选择一个)

  • 错误修复(Bugfix) issue: fix #
  • 新功能(Feature)
  • 代码重构(Refactor)
  • TypeScript 类型定义修改(Typings)
  • 文档修改(Docs)
  • 代码风格更新(Code style update)
  • 其他,请描述(Other, please describe):弃用 node18,默认以 node20 构建

这个 PR 涉及以下平台:

  • 所有小程序
  • 微信小程序
  • 支付宝小程序
  • 百度小程序
  • 字节跳动小程序
  • QQ 轻应用
  • 京东小程序
  • 快应用平台(QuickApp)
  • Web 平台(H5)
  • 移动端(React-Native)
  • 鸿蒙(harmony)

Summary by CodeRabbit

  • 新功能
    • 多个依赖包和平台包的最低 Node.js 版本要求从 18 升级到 20。
    • 新增和调整部分依赖项,包括引入 axios、base64-js、change-case、jsonp-retry 等。
  • 依赖更新
    • @types/node 相关依赖和模板版本升级至 20。
    • 移除部分包中的 @types/node。
    • pnpm 相关工具升级至 v4。
  • 文档
    • 更新贡献指南,推荐 Node.js 20 和 pnpm 10。
  • 构建与测试
    • CI 流程和脚本统一使用 Node.js 20,移除对 18 的支持。
  • 其他
    • .gitignore 新增 chrome 忽略规则。

Copy link

coderabbitai bot commented May 17, 2025

"""

Walkthrough

本次变更统一将项目及各子包的最低 Node.js 版本要求从 18 升级到 20,并同步更新了相关依赖(如 @types/node)和 CI/CD 工作流配置文件中的 Node.js 版本。部分包的依赖顺序调整、冗余依赖移除,以及开发文档和 .gitignore 文件的补充也包含在内。

Changes

文件/路径分组 变更摘要
.github/dependabot.yml 修正 @types/node 的忽略版本范围为 ">= 13, < 20"。
.github/workflows/build-rust-binding.yml
.github/workflows/nodejs.yml
.github/workflows/publish.yml
.github/workflows/sync-components-types.yml
CI 工作流 Node.js 版本从 18 升级到 20,pnpm action 升级到 v4,并同步调整相关步骤名称与注释。
.gitignore 增加 "chrome" 到忽略列表。
CONTRIBUTING.md 开发文档 Node.js 推荐版本从 16 升级到 20,pnpm 要求从 7 升级到 10,npm link 文档链接更新。
package.json @types/node 依赖从 ^18 升级到 ^20.5.1,typescript 依赖顺序微调,新增 devEngines 字段。
npm//package.json
packages/
/package.json
packages/taro-cli/templates/*/package.json.tmpl
所有包的 engines.node 要求从 ">= 18" 升级到 ">= 20",@types/node 相关依赖从 ^18 升级到 ^20。
packages/taro-platform-harmony-cpp/package.json
packages/taro-platform-harmony-hybrid/package.json
移除 @types/node devDependency,harmony-hybrid 包新增 axios、base64-js、change-case、jsonp-retry 依赖。
其它 package.json、package.json.tmpl 依赖顺序调整,无功能性变更。

Sequence Diagram(s)

sequenceDiagram
    participant 开发者
    participant CI
    participant Node.js 20 环境
    participant 项目包

    开发者->>CI: 提交代码
    CI->>Node.js 20 环境: 拉起 Node 20 环境
    CI->>项目包: 安装依赖(Node 20 要求)
    项目包-->>CI: 依赖安装与构建
    CI-->>开发者: 反馈构建/测试结果
Loading

Suggested reviewers

  • luckyadam
  • yoyo837
  • tutuxxx

Poem

兔子挥动胡萝卜笔,
Node 升级到二十齐,
CI 流程同步跑,
依赖清理更整齐。
chrome 文件不再烦,
贡献文档耳目新,
Taro 跃进又一春!

((\
( -.-)
o_(")(")
"""

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 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 7a9e4f1 and 03ea1cb.

📒 Files selected for processing (2)
  • .github/dependabot.yml (1 hunks)
  • package.json (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/dependabot.yml
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch node20
  • Post Copyable Unit Tests in Comment

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this 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.

@coderabbitai coderabbitai bot requested review from luckyadam, tutuxxx and yoyo837 May 17, 2025 11:03
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: 3

🧹 Nitpick comments (7)
.gitignore (1)

87-87: 建议限定 chrome 忽略路径
当前新增的 chrome 忽略规则过于宽泛,可能意外忽略项目中同名目录。建议指定更明确的路径或文件模式,例如 /chrome/*.chrome 等,以免误伤其他文件。

packages/taro-cli/templates/plugin-compile/package.json.tmpl (1)

38-38: 更新 @types/node 到 ^20(模版)
将 devDependencies 中的 @types/node^18.15.11 更新为 ^20,保持与主仓库类型声明大版本同步。

建议针对模版使用更精确的次版本号(如 ^20.5.1),以便在生成插件时锁定与主仓库一致的类型声明版本。

.github/workflows/nodejs.yml (1)

51-54: 清理无关注释或补充说明用途
这里有关于 Node.js 22.x 的注释性排除,但矩阵中并未包含 22.x,建议移除这些注释或添加备注说明,以避免误解。

.github/workflows/publish.yml (1)

95-95: 建议统一 Node.js 版本规范
这里使用了 node-version: 20(精确版),而其他工作流使用 20.x(灵活版)。建议统一为 "20.x",以便自动获取小版本更新。

CONTRIBUTING.md (1)

212-212: 移除多余的 “####”
第 212 行仅包含 “####” 无实际内容,建议删除以免干扰阅读。

.github/workflows/sync-components-types.yml (1)

44-44: 精简步骤名称
将步骤名称从 “Setup Node 18” 简化为 “Setup Node” 更通用,但可考虑在名称中体现版本号(如 “Setup Node 20”),便于后续维护和排查。

packages/taro-platform-harmony-hybrid/package.json (1)

43-47: 检查依赖声明顺序一致性
将 workspace 依赖如 @tarojs/helper@tarojs/plugin-platform-h5@tarojs/service 移动到此处,建议与其他平台插件保持相同的依赖顺序策略(例如先列工作区依赖再列外部依赖,或按字母序)。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e5d3e02 and 7a9e4f1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (74)
  • .github/dependabot.yml (1 hunks)
  • .github/workflows/build-rust-binding.yml (2 hunks)
  • .github/workflows/nodejs.yml (3 hunks)
  • .github/workflows/publish.yml (1 hunks)
  • .github/workflows/sync-components-types.yml (1 hunks)
  • .gitignore (1 hunks)
  • CONTRIBUTING.md (3 hunks)
  • npm/darwin-arm64/package.json (1 hunks)
  • npm/darwin-x64/package.json (1 hunks)
  • npm/linux-x64-gnu/package.json (1 hunks)
  • npm/linux-x64-musl/package.json (1 hunks)
  • npm/win32-x64-msvc/package.json (1 hunks)
  • package.json (2 hunks)
  • packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json (1 hunks)
  • packages/babel-plugin-transform-taroapi/package.json (1 hunks)
  • packages/babel-preset-taro/package.json (1 hunks)
  • packages/create-app/package.json (1 hunks)
  • packages/css-to-react-native/package.json (1 hunks)
  • packages/eslint-config-taro/package.json (1 hunks)
  • packages/jest-helper/package.json (1 hunks)
  • packages/postcss-html-transform/package.json (1 hunks)
  • packages/postcss-plugin-constparse/package.json (1 hunks)
  • packages/postcss-pxtransform/package.json (1 hunks)
  • packages/rollup-plugin-copy/package.json (1 hunks)
  • packages/shared/package.json (1 hunks)
  • packages/stylelint-config-taro-rn/package.json (1 hunks)
  • packages/stylelint-taro-rn/package.json (1 hunks)
  • packages/stylelint-taro/package.json (1 hunks)
  • packages/taro-api/package.json (1 hunks)
  • packages/taro-cli-convertor/package.json (1 hunks)
  • packages/taro-cli/package.json (1 hunks)
  • packages/taro-cli/templates/default/package.json.tmpl (1 hunks)
  • packages/taro-cli/templates/plugin-compile/package.json.tmpl (1 hunks)
  • packages/taro-components-library-react/package.json (1 hunks)
  • packages/taro-components-library-vue3/package.json (1 hunks)
  • packages/taro-components-rn/package.json (1 hunks)
  • packages/taro-components/package.json (1 hunks)
  • packages/taro-extend/package.json (1 hunks)
  • packages/taro-framework-react/package.json (1 hunks)
  • packages/taro-framework-vue3/package.json (1 hunks)
  • packages/taro-helper/package.json (1 hunks)
  • packages/taro-loader/package.json (1 hunks)
  • packages/taro-platform-alipay/package.json (1 hunks)
  • packages/taro-platform-harmony-cpp/package.json (0 hunks)
  • packages/taro-platform-harmony-hybrid/package.json (1 hunks)
  • packages/taro-platform-jd/package.json (1 hunks)
  • packages/taro-platform-qq/package.json (1 hunks)
  • packages/taro-platform-swan/package.json (1 hunks)
  • packages/taro-platform-tt/package.json (1 hunks)
  • packages/taro-platform-weapp/package.json (1 hunks)
  • packages/taro-plugin-html/package.json (1 hunks)
  • packages/taro-plugin-http/package.json (1 hunks)
  • packages/taro-plugin-inject/package.json (1 hunks)
  • packages/taro-plugin-mini-ci/package.json (1 hunks)
  • packages/taro-plugin-react-devtools/package.json (1 hunks)
  • packages/taro-plugin-vue-devtools/package.json (1 hunks)
  • packages/taro-react/package.json (1 hunks)
  • packages/taro-rn-runner/package.json (1 hunks)
  • packages/taro-rn-style-transformer/package.json (1 hunks)
  • packages/taro-rn-supporter/package.json (1 hunks)
  • packages/taro-rn-transformer/package.json (1 hunks)
  • packages/taro-rn/package.json (1 hunks)
  • packages/taro-router-rn/package.json (1 hunks)
  • packages/taro-router/package.json (1 hunks)
  • packages/taro-runner-utils/package.json (1 hunks)
  • packages/taro-runtime-rn/package.json (1 hunks)
  • packages/taro-runtime/package.json (1 hunks)
  • packages/taro-service/package.json (1 hunks)
  • packages/taro-transformer-wx/package.json (1 hunks)
  • packages/taro-webpack5-prebundle/package.json (1 hunks)
  • packages/taro-webpack5-runner/package.json (1 hunks)
  • packages/taro-with-weapp/package.json (1 hunks)
  • packages/taro/package.json (1 hunks)
  • packages/taroize/package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/taro-platform-harmony-cpp/package.json
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Testing on Node.js (windows-latest)
  • GitHub Check: Testing on Node.js (macos-13)
  • GitHub Check: Testing on Node.js 20.x (ubuntu-latest)
🔇 Additional comments (73)
packages/taro-router-rn/package.json (1)

30-30: 确认 Node.js 引擎版本要求更新
已将 engines.node 从 ">=18" 升级为 ">=20",符合本次 PR 的统一升级目标,请确保 CI/CD、模板和文档中对 Node.js 20 的兼容性已同步验证。

packages/taro-components/package.json (1)

57-57: 确认 Node.js 引擎版本要求更新
engines.node 从 ">=18" 改为 ">=20",与仓库中其他包保持一致,建议在发布前验证各平台构建脚本对 Node.js 20 的支持情况。

packages/taro-components-rn/package.json (1)

32-32: 确认 Node.js 引擎版本要求更新
已将此包的 engines.node 要求升级至 ">=20",符合本次版本同步方案,请检查 React Native 相关工具链兼容性。

packages/taro-rn-supporter/package.json (1)

29-29: 确认 Node.js 引擎版本要求更新
engines.node 从 ">=18" 升级为 ">=20",与整体升级方向一致,请在本地和 CI 环境中验证构建及运行无误。

packages/taro-rn-style-transformer/package.json (1)

30-30: 确认 Node.js 引擎版本要求更新
升级 engines.node 到 ">=20",请确保样式转换脚本和测试框架在 Node.js 20 上运行正常。

packages/taro-cli-convertor/package.json (1)

38-38: 确认 Node.js 引擎版本更新至 ≥20
已将 engines.node>=18 升级到 >=20,与 PR 目标保持一致,确保此包在构建和运行时至少使用 Node.js 20。

packages/taro-framework-react/package.json (1)

33-33: 确认 React 插件的 Node.js 要求升级
engines.node 已从 >=18 更新为 >=20,符合升级策略,确保插件在 Node.js 20+ 环境中正确执行。

packages/taro-router/package.json (1)

34-34: 确认路由包的 Node.js 要求升级
已将 engines.node>=18 提升至 >=20,符合全局版本统一规划,无需额外修改。

packages/taro/package.json (1)

23-23: 确认核心框架包的 Node.js 要求升级
engines.node 已从 >=18 更新为 >=20,与其他核心及子包一致,保证在 Node.js 20+ 环境下稳定运行。

packages/taro-react/package.json (1)

28-28: 确认 @tarojs/react 的 Node.js 要求升级
已将 engines.node>=18 升级到 >=20,与整体迁移方案保持一致,确保在 Node.js 20+ 下兼容。

packages/taro-extend/package.json (1)

24-24: 引擎版本更新符合整体迁移策略
将 engines.node 从 “>=18” 升级到 “>=20”,与 PR 目标保持一致,确保在 Node.js 20+ 环境下正常运行。

packages/postcss-plugin-constparse/package.json (1)

9-9: 同步升级 Node.js 引擎版本
此处将 Node.js 要求从 “>=18” 提升至 “>=20”,与其他模块改动保持一致。

packages/taro-service/package.json (1)

32-32: 更新引擎版本要求
将 engines.node 从 “>=18” 更新为 “>=20”,符合仓库统一升级到 Node.js 20 的策略。

packages/taro-runner-utils/package.json (1)

26-26: Node.js 引擎版本升级
将最低运行环境要求调整为 Node.js ≥20,与其他包保持一致。

packages/taro-runtime/package.json (1)

33-33: Runtime 包 Node.js 版本对齐
升级 engines.node 至 “>=20”,与整体 PR 中对 Node.js 版本的调整保持同步。

packages/taro-rn-transformer/package.json (1)

31-31: 引擎版本更新:Node.js ≥20
已将 engines.node>=18 升级至 >=20,与整体仓库的 Node.js 版本策略保持一致。

packages/taroize/package.json (1)

55-56: 引擎版本更新:Node.js ≥20
同步将 @tarojs/taroize 的最低 Node.js 要求提升至 20,保持与其他包一致。

packages/taro-rn/package.json (1)

37-39: 引擎版本更新:Node.js ≥20
已将 engines.node 要求升至 >=20,符合本次 PR 全局升级策略。

packages/babel-preset-taro/package.json (1)

26-28: 引擎版本更新:Node.js ≥20
已统一 babel-preset-taro 的 Node.js 引擎要求为 ≥20,和仓库中其他包保持一致。

packages/rollup-plugin-copy/package.json (1)

21-22: 引擎版本更新:Node.js ≥20
rollup-plugin-copyengines.node 升级至 >=20,与整体版本同步。

packages/taro-components-library-react/package.json (1)

18-18:

✅ Verification successful

确认 Node.js 引擎版本已升级
此处已将 engines.node>=18 更新为 >=20,符合本次 PR 的目标。请确保 CI 工作流及其他 package.json 中没有遗漏旧的版本声明。

建议运行以下命令检查项目中是否仍存在 >=18 的声明:


🏁 Script executed:

rg '"node": ">=18"' -l

Length of output: 24


为确保所有 package.json 和 CI 工作流中不再遗留 >=18 的声明,请进一步运行以下脚本进行全面验证:


🏁 Script executed:

#!/bin/bash
set -e

echo "🔍 检查所有 package.json 中的 Node.js 版本声明…"
find . -name package.json -print0 | xargs -0 rg -H '"node":\s*">=18"' || echo "✅ 未发现 >=18 的声明"

echo "🔍 检查 .github/workflows 工作流文件中的 node-version…"
rg -H 'node-version:\s*18' .github/workflows || echo "✅ 未发现指向 18 的 node-version"

Length of output: 413


确认 Node.js 引擎版本已升级至 ≥20,且无遗留 ≥18 声明
扫描结果:

  • 所有 package.json 文件中未发现 "node": ">=18"
  • .github/workflows 工作流中未发现 node-version: 18

符合预期,已批准此次 Node.js 版本升级。

packages/taro-runtime-rn/package.json (1)

33-33:

❓ Verification inconclusive

确认 Node.js 引擎版本已升级
已将 engines.node>=18 更新为 >=20,与仓库中其他模块保持一致。请校验对应 CI/CD 配置已同步使用 Node.js 20。

可使用:

查找是否还有遗漏。


🏁 Script executed:

rg '"node": ">=18"' -l

Length of output: 24


下面再全面扫描一下仓库中是否还存在旧版 Node.js 要求,包括 package.json 和 CI 配置:

#!/bin/bash
# 查找所有 JSON 文件中仍然包含 ">=18" 的声明
rg -n '>=18' --glob '*.json'

# 查找 CI 配置文件(yml/yaml)中是否存在 node-version 或 node_version 设置
rg -n 'node[-_]version' -g '*.y*ml'

请确认上述命令输出为空后,再合并此更改。


下面再全面扫描 package.json 和 CI 配置,确认不存在仍指向 Node.js 18 的声明:

#!/bin/bash
# 查找所有 package.json 中 engines.node 仍要求 >=18 的情况
rg -n '"engines"\s*[:{][^}]*"node":\s*">=18"' --glob 'package.json'

# 查找 GitHub Actions 等 CI 配置里 node[-_]version 的设置
rg -n 'node[-_]version' --glob '.github/workflows/*.{yml,yaml}'

请确认上述命令均无输出后再合并此更改。


请运行以下脚本检查仓库中是否还存在 Node.js 引擎版本 >=18 的残留声明(包括 package.json 和 CI 配置):


🏁 Script executed:

#!/bin/bash
set -e

# 查找所有 package.json 中 engines.node 仍要求 >=18
rg -n '"node"\s*:\s*">=18"' --glob 'package.json'

# 查找 GitHub Actions CI 配置中 node[-_]version 的设置
rg -n 'node[-_]version' --glob '.github/workflows/*.{yml,yaml}'

Length of output: 58


请运行以下脚本(已移除 set -e),确保两个检查都能执行到位:

#!/bin/bash

# 检查所有 package.json 中 engines.node 是否仍要求 >=18
rg -n '"node":\s*">=18"' --glob 'package.json'

# 检查 GitHub Actions CI 配置中 node[-_]version 的设置
rg -n 'node[-_]version' --glob '.github/workflows/*.{yml,yaml}'

请确认以上两条命令均无输出,再合并此更改。


请使用下面脚本再次验证,确保仓库中不再有任何指向 Node.js >=18 的声明(包括 package.json 和 CI 配置):

#!/bin/bash
# 查找所有 package.json 中 engines.node 仍要求 >=18
rg -n '"node":\s*">=18"' --glob 'package.json'

# 查找 GitHub Actions CI 配置中 node-version 或 node_version 的设置
find .github/workflows -type f \( -name '*.yml' -o -name '*.yaml' \) -print0 \
  | xargs -0 rg -n 'node[-_]version'

请确认以上两条命令均无输出,再合并此更改。


请手动确认已无遗留的 Node.js >=18 声明
已将 engines.node>=18 更新为 >=20,发布前请确认:

  • 所有 package.json 中不再包含 ">=18"
  • CI 配置文件(.github/workflows/*.yml/.yaml)中未再使用 node-version: 18node_version: 18

可用以下命令检查:

rg -n '>=18' --glob '*.json'  
rg -n 'node[-_]version' --glob '.github/workflows/*.{yml,yaml}'
packages/taro-plugin-html/package.json (1)

29-29:

✅ Verification successful

确认 Node.js 引擎版本已升级
此处 engines.node 已由 >=18 升级至 >=20,符合整体版本策略。请验证所有自动化脚本已同步更新。

建议执行:

确保无残留。


🏁 Script executed:

rg '"node": ">=18"' -l

Length of output: 24


已确认 Node.js 引擎版本更新且无残留引用
通过 rg '"node": ">=18"' -l 搜索,未在仓库中发现任何旧版 Node.js 引擎声明,自动化脚本均已同步更新。

npm/darwin-x64/package.json (1)

17-17:

✅ Verification successful

确认 Node.js 引擎版本已升级
已将 engines.node>=18 升级到 >=20,与其他平台绑定包一致。请检查发布脚本和安装文档中 Node.js 要求是否同步。

可用:

查找旧声明。


🏁 Script executed:

rg '"node": ">=18"' -l

Length of output: 24


🏁 Script executed:

#!/bin/bash
# 列出所有 package.json 文件中 engines.node 字段的值,以确认是否存在遗留的 >=18 声明
if ! command -v jq &> /dev/null; then
  echo "请先安装 jq:例如 brew install jq"
  exit 1
fi

# 使用 find 遍历所有 package.json
find . -type f -name package.json | while read -r file; do
  version=$(jq -r '.engines.node // "未定义"' "$file")
  echo "${file}: ${version}"
done

Length of output: 21645


🏁 Script executed:

#!/bin/bash
# 搜索 CI 工作流中的 Node 版本设置
echo "== CI workflows: actions/setup-node =="
rg -n 'actions/setup-node' -n .github/workflows || true

echo "== CI workflows: node-version =="
rg -n 'node-version' -n .github/workflows || true

# 搜索文档中的旧 Node.js 要求(>=18)
echo "== 文档: 查找 >=18 =="
rg -n -g '*.md' '>=\s*18' || true

# 搜索文档中已更新到 >=20 的情况
echo "== 文档: 查找 >=20 =="
rg -n -g '*.md' '>=\s*20' || true

Length of output: 1708


确认 Node.js 要求已同步

  • CI 工作流(.github/workflows)已全部切换至 Node.js 20.x
  • 在所有 Markdown 文档中未发现对 Node.js 最低版本的说明

如有用户安装指引或发布说明需要补充最低版本要求,请在相应文档中添加 >=20

packages/taro-plugin-http/package.json (1)

33-33:

❓ Verification inconclusive

确认 Node.js 引擎版本已升级
此处 engines.node 已由 >=18 升级至 >=20,与整体仓库版本要求保持一致。请确保依赖关系和工具链也支持 Node.js 20。

可执行:

验证是否有遗漏。


🏁 Script executed:

rg '"node": ">=18"' -l

Length of output: 24


确保 Node.js 引擎版本已统一升级

  • packages/taro-plugin-http/package.json 中,engines.node 已从 >=18 升级为 >=20
  • 运行 rg '"node": ">=18"' -l 未在仓库中检出任何旧版本引用

请手动确认:

  • 所有依赖包及插件是否均兼容 Node.js 20
  • CI/CD 配置(如 .nvmrc、Dockerfile、GitHub Actions 等)中是否有其他 Node.js 版本限制
packages/taro-platform-jd/package.json (1)

29-31: 确认 Node.js 引擎版本已升级至 >=20
此更改符合 PR 目标,将最低 Node.js 版本从 18 升级到 20,与仓库中其他平台包保持一致。

packages/taro-platform-tt/package.json (1)

29-31: 确认 Node.js 引擎版本已升级至 >=20
已将 engines.node 字段统一提升至 >=20,确保与整个项目的版本策略一致。

packages/taro-platform-swan/package.json (1)

29-31: 确认 Node.js 引擎版本已升级至 >=20
此更改与其他平台插件同步,将最低 Node.js 要求更新为 >=20。

packages/css-to-react-native/package.json (1)

53-55: 确认 Node.js 引擎版本已升级至 >=20
已将此包的 engines.node 限制从 18 升级到 20,保持与其他包一致。

packages/taro-platform-weapp/package.json (1)

28-30: 确认 Node.js 引擎版本已升级至 >=20
将最低 Node.js 要求提升至 >=20,符合本次统一升级计划。

packages/taro-platform-alipay/package.json (1)

30-30:

✅ Verification successful

确认 Node.js 引擎版本更新
"node" 引擎要求从 >=18 升级到 >=20,符合本次 PR 的目标。请确认所有相关文档(如 .nvmrc、README.md)和 CI/CD 配置已经同步切换到 Node.js 20.x。

运行以下脚本以检查仓库中是否还有未升级的 Node.js 引擎配置:


🏁 Script executed:

#!/bin/bash
# 查找仍使用 Node.js >=18 的 package.json 文件
rg '"node":\s*">=18"' -l

Length of output: 26


为了全面验证,请执行以下脚本,检查所有 package.json.nvmrcREADME.md 以及 CI/CD 配置中的 Node.js 版本引用:


🏁 Script executed:

#!/usr/bin/env bash
set -e

echo "1. 搜索所有 package.json 中的 Node 引擎声明:"
rg '"node":' -n -g 'package.json' || echo "未找到任何 '\"node\":' 声明"

echo
echo "2. 检查根目录下的 .nvmrc 文件是否存在及其内容:"
if [ -f .nvmrc ]; then
  echo "---- .nvmrc 内容 ----"
  cat .nvmrc
  echo "---------------------"
else
  echo ".nvmrc 文件不存在"
fi

echo
echo "3. 在 README.md 中查找 '18' 版本引用:"
if [ -f README.md ]; then
  rg -n "18" README.md || echo "README.md 中未找到 '18' 引用"
else
  echo "README.md 文件不存在"
fi

echo
echo "4. 在 CI/CD workflow (.github/workflows) 中查找 Node.js 18 引用:"
if [ -d .github/workflows ]; then
  rg -n -e "node[-_]version:\s*18" .github/workflows || echo "workflow 中未找到 Node.js 18 引用"
else
  echo ".github/workflows 目录不存在"
fi

Length of output: 4908


确认 Node.js 引擎版本已统一更新至 ≥20

经检索:

  • 所有 package.json 中的 "node" 引擎要求均为 >=20
  • 根目录不存在 .nvmrc 文件
  • README.md 未发现任何与 Node.js 18 相关的版本说明
  • CI/CD workflows(.github/workflows)中未找到 Node.js 18 的引用

无需进一步操作,PR 可合并。

packages/babel-plugin-transform-taroapi/package.json (1)

19-19: 引擎字段更新正确
"engines": { "node": ">=20" } 已按仓库统一要求更新,无需额外修改。

packages/taro-webpack5-prebundle/package.json (1)

33-33: 引擎版本升级符合预期
已将 Node.js 最低版本从 >=18 更新为 >=20,与其他包保持一致。

packages/stylelint-config-taro-rn/package.json (1)

26-26: 确认 Node.js 引擎版本更新
已将 "node" 引擎版本从 >=18 更新为 >=20,与全局版本要求保持一致。

packages/shared/package.json (1)

33-33: 确认 Node.js 引擎版本更新
已将 "node" 引擎版本从 >=18 更新为 >=20,与仓库统一要求保持一致。

packages/taro-platform-qq/package.json (1)

30-30: 确认 Node.js 引擎版本更新
已将 "node" 引擎版本从 >=18 升级为 >=20,与其余插件包保持一致。

packages/taro-rn-runner/package.json (1)

31-31: 确认 Node.js 引擎版本更新
已将 "node" 引擎版本从 >=18 升级为 >=20,符合整体迁移策略。

packages/taro-cli/package.json (1)

43-43: 确认 Node.js 引擎版本更新
已将 "node" 引擎最低版本要求从 >=18 更新为 >=20,与 CI/CD 和其他包保持同步。

packages/postcss-html-transform/package.json (1)

27-27: Node 引擎版本已升级
已将 engines.node 最低版本要求从 >=18 更新至 >=20,与仓库中其他包的配置保持一致。

packages/stylelint-taro/package.json (1)

38-38: 统一升级 Node 引擎版本
已将 engines.node 最低版本要求从 >=18 更新至 >=20,与整体迁移到 Node.js 20 的目标一致。

packages/taro-with-weapp/package.json (1)

33-33: 同步更新 Node.js 最低版本
engines.node 要求升级为 >=20,确保与其他平台包保持一致。

packages/stylelint-taro-rn/package.json (1)

42-42: Node 环境要求已改为 ≥20
已将 engines.node>=18 提升至 >=20,符合项目整体 Node 版本策略。

packages/taro-transformer-wx/package.json (1)

33-33: 升级 Node.js 引擎版本声明
已将 engines.node 最低版本更新为 >=20,与其他 Package.json 保持同步。

packages/postcss-pxtransform/package.json (1)

34-34: 确认 Node.js 引擎版本更新
"engines.node"">=18" 升级到 ">=20",与仓库其它包统一,符合项目整体版本策略。

npm/win32-x64-msvc/package.json (1)

17-17: 统一 Node.js 引擎版本要求
"engines.node"">=18" 升级到 ">=20",保持与主仓库及其它绑定包一致。

packages/taro-plugin-vue-devtools/package.json (1)

30-30: 同步升级 Node.js 引擎版本
"engines.node"">=18" 提升到 ">=20",与全局版本基线保持一致。

packages/taro-webpack5-runner/package.json (1)

33-33: 更新 engines.node 版本范围
已将 Node.js 最低版本从 18 升级到 20,确保与其他平台包的版本要求一致。

packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json (1)

26-26: 调整 Node.js 最低版本要求
"engines.node"">=18" 升至 ">=20",符合本次全仓库统一升级策略。

packages/taro-loader/package.json (1)

28-30: 更新 Node 引擎版本至 >=20
此更改符合 PR 目标,将 @tarojs/taro-loader 的最低 Node.js 要求从 18 升级至 20,确保打包环境与全局策略一致。

npm/darwin-arm64/package.json (1)

16-18: 统一升级 Node 引擎版本要求
@tarojs/binding-darwin-arm64engines.node>=18 更新为 >=20,与其他平台包保持一致。

packages/taro-plugin-react-devtools/package.json (1)

30-31: 升级 Node 引擎版本要求到 >=20
已将插件的 engines.node>=18 改为 >=20,确保与整体升级策略保持一致。

package.json (1)

98-98: @types/node 升级至 ^20.5.1
此更改确保根仓库使用与 Node.js 20 兼容的最新类型定义。

packages/taro-api/package.json (1)

38-38: 确认 Node.js 引擎版本已更新至 ≥20
已将 "engines": { "node": ">=20" } 从原先的 >=18 升级至 >=20,与 PR 目标一致,确保在新环境下正确运行。

packages/jest-helper/package.json (1)

21-21: 确认 Node.js 引擎版本已更新至 ≥20
已将 "engines": { "node": ">=20" } 从原先的 >=18 升级至 >=20,符合全局版本规范。

packages/taro-helper/package.json (1)

39-39: 确认 Node.js 引擎版本已更新至 ≥20
已将 "node": ">=20">=18 升级至 >=20,与其他包保持一致,无影响现有配置。

packages/taro-plugin-mini-ci/package.json (1)

32-32: 确认 Node.js 引擎版本已更新至 ≥20
已将 "engines": { "node": ">=20" }>=18 调整为 >=20,符合项目统一要求。

packages/taro-plugin-inject/package.json (1)

29-29: 确认 Node.js 引擎版本已更新至 ≥20
已将 "engines": { "node": ">=20" }>=18 更新为 >=20,一致性校验通过。

npm/linux-x64-musl/package.json (1)

16-17: 更新 Node.js 引擎版本要求到 >=20
与仓库中其他平台绑定包保持一致,已正确将 "engines.node">=18 升级到 >=20

npm/linux-x64-gnu/package.json (1)

17-18: 统一 Node.js 引擎最低版本到 >=20
与其它平台绑定包同步更新,符合 PR 目标。

packages/taro-components-library-vue3/package.json (1)

18-19: 同步组件库包的 Node.js 引擎版本到 >=20
确保与整体项目要求保持一致,"engines.node" 已正确更新。

packages/create-app/package.json (1)

30-31: 将 create-app 包的 Node.js 引擎要求升级至 >=20
与整体项目及 CI 配置保持一致,"engines.node" 更新符合 PR 目标。

packages/eslint-config-taro/package.json (1)

26-27: 升级 ESLint 配置包的 Node.js 引擎要求到 >=20
与其它包一致,已正确同步 "engines.node"

.github/workflows/build-rust-binding.yml (2)

17-17: 升级 Node.js 版本至 20.x
已将构建矩阵的 Node.js 版本从 18.x 更新到 20.x,与此次 PR “Node20” 目标保持一致,确保 CI 环境同步到最新 LTS 版本。


50-50: 升级 pnpm 设置 Action 至 v4
pnpm/action-setup 从 v3 升级至 v4,并继续使用 pnpm 10,符合其他工作流的约定。

.github/dependabot.yml (1)

12-12: 更新 Dependabot 忽略范围以匹配 Node.js 20
已将 @types/node 的忽略版本范围从旧的 “>= 18” 调整为 “>= 20, < 21”,与项目最低 Node.js 20 要求保持一致。

.github/workflows/nodejs.yml (2)

39-39: 将测试矩阵 Node.js 版本切换到 20.x
已移除 18.x,仅保留 20.x 进行测试,符合项目对 Node.js 20 的统一升级策略。


65-65: 升级 pnpm 设置 Action 至 v4
已将 pnpm/action-setup 从 v3 升级至 v4,与其他工作流同步 pnpm 版本管理。

.github/workflows/publish.yml (1)

89-89: 升级 pnpm 设置 Action 至 v4
发布流程中同步将 pnpm/action-setup 升级至 v4,保持全局一致性。

CONTRIBUTING.md (2)

13-13: 更新贡献指南中的 Node.js 和 pnpm 版本
已将推荐的 Node.js 升级至 v20.19.1+,pnpm 升级至 10,与全局 CI 和 package.json 要求保持一致。


39-39: 修正 npm link 文档链接版本
已将 npm link 文档链接更新至 v11,对应最新 npm CLI 版本,避免误导使用旧版文档。

.github/workflows/sync-components-types.yml (2)

37-37: 升级 pnpm setup 动作版本
uses: pnpm/action-setup@v4 从 v3 升级到 v4 是必要的,以便支持 pnpm10。请确认 pnpm/action-setup@v4 在现有 CI 环境中行为一致,并且不需要额外参数调整。


47-47: 切换 Node.js 版本到 20
已将 node-version 从 18 提升至 20,符合 PR 目标。但请确认所有依赖和自定义脚本(尤其是涉及 ts-node 或原生插件)在 Node20 下兼容。

packages/taro-platform-harmony-hybrid/package.json (1)

59-70: 确认 @types/node 类型声明可用性
此处 devDependencies 已不包含 @types/node,请核实项目根目录或其他包中是否已统一提供 Node.js 类型定义,以确保打包和 IDE 支持不受影响。

@@ -26,7 +26,7 @@
"url": "https://github.com/NervJS/taro/issues"
},
"engines": {
"node": ">= 18"
"node": ">=20"
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

升级 Node.js 引擎版本至 ≥20,与整体仓库保持一致
此处将本包的最低 Node.js 要求从 18 升级至 20,符合本次 PR “Node20” 的目标。请确保 CI/CD、自动化脚本以及其他子包的 engines.node 字段也已同步更新,并验证所有构建和运行流程在 Node.js 20 环境下均能正常工作。

建议运行以下脚本,快速检查所有 package.json 中的 engines.node 设置:


🏁 Script executed:

#!/bin/bash
# 验证所有 package.json 中 engines.node 是否为 >=20
fd -e json package.json -x jq -r '.engines.node' {} | sort | uniq

Length of output: 77


同步更新所有子包的 Node.js 引擎版本至 ≥20
脚本校验结果显示,存在部分 package.jsonengines.nodenull,意味着未指定最低 Node.js 版本。请检查并将所有子包的 engines.node 字段统一更新为 ">=20",然后验证 CI/CD、自动化脚本及构建流程在 Node.js 20 环境下能正常运行。

建议操作:

  • 查找未指定或不符合要求的 package.json
    fd -e json package.json -x jq -r '.engines.node // "未指定"' {} | sort | uniq
  • 针对输出为 未指定 或其他非 >=20 的文件,将对应字段修改为:
    "engines": {
      "node": ">=20"
    }
  • 更新完成后,重新运行上述脚本确认所有返回值均为 >=20
🤖 Prompt for AI Agents
In packages/taro-framework-vue3/package.json at line 29, update the
"engines.node" field to ">=20" to align with the overall repository Node.js
version requirement. Then, check all other package.json files in the repository
for missing or outdated "engines.node" fields using the provided shell commands,
update them to ">=20" as needed, and verify that CI/CD pipelines and build
processes work correctly under Node.js 20.

@@ -107,7 +107,7 @@
"typescript": "^5.4.5",
"tsconfig-paths-webpack-plugin": "^4.1.0"{{/if}},
"postcss": "^8.4.38",
"@types/node": "^18"
"@types/node": "^20"
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

在模板中同步添加 engines 字段
虽然已将 @types/node 升级至 ^20,但模板中缺少对 Node.js 版本的引擎声明。建议在 package.json.tmpl 中增加:

+  "engines": {
+    "node": ">=20"
+  },

确保新生成的项目在初始化时就包含该配置。

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

🤖 Prompt for AI Agents
In packages/taro-cli/templates/default/package.json.tmpl at line 110, the
template lacks an "engines" field specifying the required Node.js version,
despite upgrading "@types/node" to "^20". Add an "engines" section to the
package.json template that declares the compatible Node.js version range to
ensure new projects generated from this template include this configuration from
the start.

Comment on lines +50 to +54
"axios": "^1.6.8",
"babel-plugin-transform-taroapi": "workspace:*",
"base64-js": "^1.5.1",
"change-case": "^4.1.2",
"jsonp-retry": "^1.0.3",
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

验证新增外部包的类型声明
已新增 axiosbase64-jschange-casejsonp-retrywhatwg-fetch 等运行时依赖。请确认这些包自带 TypeScript 类型,或在 devDependencies 中补充对应的 @types/*,以避免在打包或 IDE 中出现缺失类型提示。

Also applies to: 57-57

🤖 Prompt for AI Agents
In packages/taro-platform-harmony-hybrid/package.json around lines 50 to 57, you
added runtime dependencies like axios, base64-js, change-case, jsonp-retry, and
whatwg-fetch without verifying their TypeScript type declarations. Check if
these packages include built-in TypeScript types; if not, add the corresponding
@types/* packages to devDependencies to ensure proper type support during build
and in IDEs.

Copy link

codecov bot commented May 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.37%. Comparing base (e5d3e02) to head (03ea1cb).

❌ Your project check has failed because the head coverage (59.37%) is below the target coverage (75.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #17727   +/-   ##
=======================================
  Coverage   59.37%   59.37%           
=======================================
  Files         387      387           
  Lines       23417    23417           
  Branches     5150     5141    -9     
=======================================
  Hits        13903    13903           
- Misses       8013     8053   +40     
+ Partials     1501     1461   -40     
Flag Coverage Δ
taro-cli 72.37% <ø> (ø)
taro-runtime 59.87% <ø> (ø)
taro-web 53.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 15 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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