Skip to content

Conversation

@ianzone
Copy link
Contributor

@ianzone ianzone commented Jun 6, 2025

这个 PR 做了什么? (简要描述所做更改)
将 react、react-dom 提升到根工作区,统一管理版本

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

  • 错误修复 (Bugfix) issue: fix #
  • 新功能 (Feature)
  • 代码重构 (Refactor)
  • TypeScript 类型定义修改 (Types)
  • 文档修改 (Docs)
  • 代码风格更新 (Code style update)
  • 构建优化 (Chore)
  • 其他,请描述 (Other, please describe):

这个 PR 涉及以下平台:

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

Summary by CodeRabbit

  • 新功能

    • 升级多个示例项目和主项目对 React 及其类型定义的依赖至 React 18,提升兼容性和新特性支持。
    • 新增部分包的 Vitest 测试配置文件,统一测试文件匹配规则和覆盖率设置。
    • 为 Vue3 框架插件新增测试用例,验证生命周期钩子集成。
  • 重构

    • 调整各包对 React 相关依赖的管理方式,统一 peerDependencies 版本范围,移除部分 devDependencies 中的 React 及类型依赖。
    • 删除部分包的 TypeScript 配置中对 React 模块的路径映射。
    • 移除 Vue3 框架插件的 Rollup 配置及入口导出文件,改用 exports 字段。
  • 杂项

    • 更新部分测试和工具依赖,切换测试覆盖率工具,优化依赖版本范围设置。
    • 修正部分描述字段格式。
    • 调整部分包依赖顺序及新增若干依赖包以支持功能扩展。

@coderabbitai
Copy link

coderabbitai bot commented Jun 6, 2025

"""

Walkthrough

本次变更主要集中于各示例项目和核心包的 package.json 文件,统一升级或调整了 React 及其类型定义依赖的版本要求。部分包移除了对 React 及类型定义的开发依赖,部分包更新了 peerDependencies 的 React 版本范围,部分包则将相关依赖的版本号从具体小版本放宽为主版本号。除此之外,还涉及测试覆盖工具的替换和描述字段的小幅调整。

Changes

文件路径分组 变更摘要
examples/blended-apart/taro-project/package.json
examples/blended-basic/taro-project/package.json
examples/blended-taro-component/h5/package.json
examples/blended-taro-component/taro-project/package.json
examples/new-blended/taro-project/package.json
React 及其类型定义依赖从 16 升级到 18,更新了 dependencies 和 devDependencies。
examples/build-weapp-plugin/package.json
examples/swiper-effect/package.json
examples/taro-list/package.json
@types/react 的依赖范围由 ^18.0.0 放宽为 ^18
examples/custom-tabbar-react/package.json
examples/mini-split-chunks-plugin/package.json
examples/weapp-independent-subpackages/package.json
React 及 @types/react 由 17.x 升级到 18,范围放宽为 ^18
examples/mini-program-example/package.json 描述字段由“demo”前加空格,@types/react 依赖范围由 ^18.2.0 放宽为 ^18
package.json React 及类型定义、测试工具相关依赖升级,覆盖工具由 v8 切换为 istanbul,增加/升级 React 相关依赖。
packages/taro-components-advanced/package.json 移除 devDependencies 中的 React 相关依赖,peerDependencies 的 React 版本由 >=17 升级为 >=18
packages/taro-components-library-react/package.json 移除 devDependencies 中的 React 及 React DOM 依赖。
packages/taro-components-react/package.json 移除 devDependencies 中的 React 依赖,peerDependencies 保持为 "*"
packages/taro-components-rn/package.json
packages/taro-rn/package.json
devDependencies 中移除 React,peerDependencies 的 React 由 ^18.2.0 放宽为 ^18
packages/taro-framework-react/package.json 移除 devDependencies 中的 React 及 React DOM 类型定义依赖。
packages/taro-h5/package.json 移除 devDependencies 中的 React 依赖。
packages/taro-platform-harmony-cpp/package.json 移除 dependencies 中的 @types/react@types/react-reconciler
packages/taro-react/package.json 完全移除 devDependencies,包括 React 及类型定义依赖。
packages/taro-rn-runner/package.json
packages/taro-router-rn/package.json
移除 devDependencies 中的 React,peerDependencies 的 React 由 ^18.2.0 放宽为 ^18
packages/taro-rn-supporter/package.json
packages/taro-runtime-rn/package.json
移除 devDependencies 中的 React 依赖。
packages/taro-runtime/package.json 移除 devDependencies 中的 @types/react 和 React 依赖。
packages/taro-with-weapp/package.json 完全移除 devDependencies,包括 React 及 React DOM 依赖。
packages/taro/package.json 移除 devDependencies 中的 @types/react 依赖。
tests/package.json 移除 devDependencies 中的 React 依赖。
packages/taro-components-rn/tsconfig.json
packages/taro-rn/tsconfig.json
packages/taro-router-rn/tsconfig.json
packages/taro-runtime-rn/tsconfig.json
移除 tsconfig.jsonpaths 配置里对 react 的路径映射。
packages/taro-rn-runner/vitest.config.ts 新增 Vitest 配置文件,配置测试文件匹配规则及 Istanbul 覆盖率。
packages/taro-rn-style-transformer/vitest.config.ts 新增 Vitest 配置文件,配置测试文件匹配规则及 Istanbul 覆盖率。
packages/taro-platform-harmony-hybrid/package.json 依赖项重新排序,新增 axios、base64-js、change-case、jsonp-retry、react 等依赖。
packages/taro-platform-harmony-hybrid/src/api/apis/base/weapp/app-event.ts 修改 query-string 导入方式为默认导入,调用方式改为 qs.parse,并调整注释格式。
packages/taro-framework-vue3/index.js 删除文件,移除对 ./dist/index.js 的 CommonJS 和 ES 模块导出。
packages/taro-framework-vue3/package.json 替换 "main" 字段为 "./dist/index.js",移除 "index.js" 文件声明,新增 Vitest 测试脚本。
packages/taro-framework-vue3/rollup.config.mjs 删除 Rollup 构建配置文件,包含三个构建配置。
packages/taro-framework-vue3/tests/vue.spec.ts 新增 Vue 3 生命周期钩子测试,验证 app 和页面生命周期调用。
packages/taro-framework-vue3/vitest.config.ts 新增 Vitest 配置文件,设置测试文件匹配及覆盖率。
packages/taro-framework-vue3/vitest.setup.ts 新增 Vitest 全局环境设置,模拟 DOM 相关全局对象。
packages/taro-runtime/jest.config.js 移除 Jest 配置中对 @tarojs/plugin-framework-vue3/dist/runtime 的模块映射。
packages/taro-runtime/src/tests/vue.spec.js 删除 Vue 3 生命周期集成测试文件,包含 app 和页面生命周期钩子测试。

Suggested reviewers

  • yoyo837
  • tutuxxx

Poem

兔子在田间蹦蹦跳,
React 版本齐升级,
类型依赖轻松扫,
旧包新包都清理,
项目更稳心欢喜!
🐇✨
"""


📜 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 0d0df42 and 4754829.

📒 Files selected for processing (1)
  • packages/taro-framework-vue3/package.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/taro-framework-vue3/package.json
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-musl
  • GitHub Check: Build Rust WASM / stable - wasm32-wasi
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
  • 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 deps
  • 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 auto-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 and tutuxxx June 6, 2025 19:31
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

🔭 Outside diff range comments (1)
packages/taro-components-library-react/package.json (1)

24-28: 🛠️ Refactor suggestion

补充 React 相关 peerDependencies
由于移除了 reactreact-dom 的 devDependencies,建议在 peerDependencies 中声明它们:

 "peerDependencies": {
+  "react": "^18",
+  "react-dom": "^18",
   "@tarojs/helper": "workspace:*"
 }
🧹 Nitpick comments (5)
packages/taro-components-advanced/package.json (1)

42-42: 版本规范不一致
此处将 reactpeerDependencies 版本指定为 ">=18",而库内其他位置使用 ^18 作为主版本范围,建议统一为 ^18 以保持语义一致性。

examples/new-blended/taro-project/package.json (1)

39-39: 请确认是否需要在非 TypeScript 示例中保留 @types/react
模板配置 "typescript": false,如不使用 TS,建议移除冗余类型定义以精简依赖。

examples/blended-taro-component/h5/package.json (1)

40-40: 请确认是否需要在非 TypeScript 示例中保留 @types/react
模板配置 "typescript": false,如不使用 TS,建议移除冗余类型定义以精简依赖。

examples/blended-taro-component/taro-project/package.json (1)

42-42: 请确认是否需要在非 TypeScript 示例中保留 @types/react
模板配置 "typescript": false,如不使用 TS,建议移除冗余类型定义以精简依赖。

examples/blended-apart/taro-project/package.json (1)

37-37: 请确认是否需要在非 TypeScript 示例中保留 @types/react
模板配置 "typescript": false,如不使用 TS,建议移除冗余类型定义以精简依赖。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0997d9e and 2841f22.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (30)
  • examples/blended-apart/taro-project/package.json (1 hunks)
  • examples/blended-basic/taro-project/package.json (1 hunks)
  • examples/blended-taro-component/h5/package.json (1 hunks)
  • examples/blended-taro-component/taro-project/package.json (1 hunks)
  • examples/build-weapp-plugin/package.json (1 hunks)
  • examples/custom-tabbar-react/package.json (1 hunks)
  • examples/mini-program-example/package.json (2 hunks)
  • examples/mini-split-chunks-plugin/package.json (1 hunks)
  • examples/new-blended/taro-project/package.json (1 hunks)
  • examples/swiper-effect/package.json (1 hunks)
  • examples/taro-list/package.json (1 hunks)
  • examples/weapp-independent-subpackages/package.json (1 hunks)
  • package.json (4 hunks)
  • packages/taro-components-advanced/package.json (1 hunks)
  • packages/taro-components-library-react/package.json (1 hunks)
  • packages/taro-components-react/package.json (0 hunks)
  • packages/taro-components-rn/package.json (1 hunks)
  • packages/taro-framework-react/package.json (0 hunks)
  • packages/taro-h5/package.json (0 hunks)
  • packages/taro-platform-harmony-cpp/package.json (0 hunks)
  • packages/taro-react/package.json (0 hunks)
  • packages/taro-rn-runner/package.json (1 hunks)
  • packages/taro-rn-supporter/package.json (0 hunks)
  • packages/taro-rn/package.json (1 hunks)
  • packages/taro-router-rn/package.json (1 hunks)
  • packages/taro-runtime-rn/package.json (0 hunks)
  • packages/taro-runtime/package.json (0 hunks)
  • packages/taro-with-weapp/package.json (0 hunks)
  • packages/taro/package.json (0 hunks)
  • tests/package.json (0 hunks)
💤 Files with no reviewable changes (11)
  • tests/package.json
  • packages/taro/package.json
  • packages/taro-h5/package.json
  • packages/taro-runtime/package.json
  • packages/taro-platform-harmony-cpp/package.json
  • packages/taro-react/package.json
  • packages/taro-rn-supporter/package.json
  • packages/taro-components-react/package.json
  • packages/taro-runtime-rn/package.json
  • packages/taro-with-weapp/package.json
  • packages/taro-framework-react/package.json
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
  • GitHub Check: Build Rust WASM / stable - wasm32-wasi
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
🔇 Additional comments (20)
packages/taro-router-rn/package.json (1)

48-48: 确认根工作区依赖覆盖
已将 reactdevDependencies 移除,并在 peerDependencies 中更新为 ^18,请验证根工作区已正确声明并安装 react@^18,以避免打包或运行时缺失该依赖。

examples/swiper-effect/package.json (1)

67-67: 类型依赖更新合理
@types/react 放宽到 ^18 与依赖中的 react@^18.0.0 保持兼容,改动没有问题。

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

67-67: 放宽 React peerDependencies 版本至 ^18
已将 reactpeerDependencies^18.2.0 放宽为 ^18,提升兼容性。

examples/build-weapp-plugin/package.json (1)

36-36: 放宽 @types/react 版本范围至 ^18
已将 @types/react^18.0.0 扩展为 ^18,允许任何 18.x 小版本。

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

67-67: 放宽 React peerDependencies 版本至 ^18
已将 reactpeerDependencies^18.2.0 放宽为 ^18,确保适配任意 React 18.x 版本。

examples/taro-list/package.json (1)

66-66: 放宽 @types/react 版本范围至 ^18
已将 @types/react^18.0.0 扩展为 ^18,与其他示例项目保持一致。

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

98-98: 将 React 移动到 peerDependencies 以统一版本管理
reactdevDependencies 移动到 peerDependencies 对 RN 使用场景更合理,确保宿主项目安装时按需引入。

examples/mini-program-example/package.json (2)

5-5: 描述字段格式调整
"小程序demo" 更新为 "小程序 demo",以统一项目间的描述格式。


67-67: 扩展 @types/react 版本范围
@types/react^18.2.0 放宽为 ^18,增强对 React 18 各次版本的兼容性。

package.json (5)

101-103: 升级 React 类型定义至最新次版本
@types/react@types/react-dom@types/react-reconciler 升级到 ^18.3.x^18.3.x^0.28.x,保持与 React 运行时版本一致。


111-111: 切换覆盖率工具至 Istanbul
将测试覆盖工具从 @vitest/coverage-v8 替换为 @vitest/coverage-istanbul,以获得更完善的覆盖率报告兼容性。


153-154: 在根目录添加 React 运行时依赖
reactreact-dom 升级至 ^18.3.1,统一根工作区与子包的 React 版本。


167-167: 升级测试框架 Vitest 版本
vitest 升级至 ^3.2.2,与新覆盖率插件保持兼容性。


179-179: 覆盖 react-native-root-siblings peerDependencies
react-native-root-siblingsreact peer 依赖锁定为 18.3.1,确保与根依赖版本一致。

examples/blended-basic/taro-project/package.json (2)

29-30: 升级示例项目 React 运行时依赖
reactreact-dom 升级至 ^18,与其他示例和根版本保持一致。


34-34: 扩展示例项目 React 类型定义版本
@types/react 升级至 ^18,与运行时依赖版本同步。

examples/new-blended/taro-project/package.json (1)

33-34: 统一升级 React 与 React-DOM 至 ^18
与根工作区依赖保持一致,确保所有示例项目使用相同版本。

examples/blended-taro-component/h5/package.json (1)

34-35: 统一升级 React 与 React-DOM 至 ^18
与根工作区依赖保持一致,确保所有示例项目使用相同版本。

examples/blended-taro-component/taro-project/package.json (1)

36-37: 统一升级 React 与 React-DOM 至 ^18
与根工作区依赖保持一致,确保所有示例项目使用相同版本。

examples/blended-apart/taro-project/package.json (1)

29-30: 统一升级 React 与 React-DOM 至 ^18
与根工作区依赖保持一致,确保所有示例项目使用相同版本。

@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.90%. Comparing base (078c7f1) to head (2333a19).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17810      +/-   ##
==========================================
- Coverage   59.83%   55.90%   -3.94%     
==========================================
  Files         405      417      +12     
  Lines       23755    21693    -2062     
  Branches     5239     5364     +125     
==========================================
- Hits        14214    12127    -2087     
+ Misses       8052     7962      -90     
- Partials     1489     1604     +115     
Flag Coverage Δ
taro-cli 72.42% <ø> (ø)
taro-runtime 59.87% <ø> (ø)
taro-web 53.19% <ø> (ø)

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

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

This was referenced Jun 7, 2025
@yoyo837 yoyo837 merged commit 1f097d5 into NervJS:main Jun 15, 2025
24 checks passed
@ianzone ianzone deleted the deps branch June 15, 2025 14:45
This was referenced Jun 21, 2025
@coderabbitai coderabbitai bot mentioned this pull request Aug 26, 2025
27 tasks
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.

2 participants