-
Notifications
You must be signed in to change notification settings - Fork 269
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: remove rn's, and update taro version #2731
Conversation
Walkthrough本次拉取请求主要涉及对 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant TaroComponents
User->>App: 访问应用
App->>TaroComponents: 加载组件
TaroComponents-->>App: 返回组件
App-->>User: 显示界面
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Warning There were issues while running the following tools: 🔧 eslintpackages/nutui-taro-demo/src/pages/index/index.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the config "taro/react" to extend from. Please check that the name of the config is correct. The config "taro/react" was referenced from the config file in "/packages/nutui-taro-demo/.eslintrc". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. 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 (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## V3.0 #2731 +/- ##
=======================================
Coverage 83.98% 83.98%
=======================================
Files 221 221
Lines 17867 17867
Branches 2676 2676
=======================================
Hits 15005 15005
Misses 2857 2857
Partials 5 5 ☔ View full report in Codecov by Sentry. |
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: 0
🧹 Outside diff range and nitpick comments (5)
pnpm-workspace.yaml (1)
2-2
: 建议在文件末尾添加换行符根据 YAML 规范和常见的编码规范,建议在文件末尾添加一个换行符。
建议应用以下修改:
packages: - 'packages/*' +
🧰 Tools
🪛 yamllint
[error] 2-2: no new line character at the end of file
(new-line-at-end-of-file)
packages/nutui-taro-demo/src/pages/index/index.tsx (2)
38-52
: 建议优化图片资源管理虽然代码格式规范性有所提升,但建议将图片URL迁移到配置文件或常量中统一管理,避免硬编码。
建议如下重构:
+// 在单独的配置文件中定义 +const ASSETS = { + logo: 'https://img14.360buyimg.com/imagetools/jfs/t1/117879/25/28831/6279/6329723bE66715a2f/5f099b8feca9e8cc.png' +} <Image className="index-header-img" - src="https://img14.360buyimg.com/imagetools/jfs/t1/117879/25/28831/6279/6329723bE66715a2f/5f099b8feca9e8cc.png" + src={ASSETS.logo} />
56-70
: 建议简化条件渲染逻辑当前的条件渲染逻辑较为复杂,建议提取判断条件到独立函数以提高可读性。
建议如下重构:
+const isDisplayableComponent = (com) => { + return com.show && com.taro && com.version === '3.0.0'; +} <View className="index-components-sublist"> - {nav.packages.map((com) => - com.show && com.taro && com.version === '3.0.0' ? ( + {nav.packages.map((com) => + isDisplayableComponent(com) ? ( <View key={com.name} className="index-components-sublist-item" >packages/nutui-taro-demo/package.json (2)
64-80
: 建议进行全面的升级后测试所有 Taro 核心包已更新至 4.0.8-beta.0 版本,这是一个重要的版本升级。建议:
- 查看 Taro 4.0.8-beta.0 的更新日志,了解破坏性变更
- 确保所有平台的构建和运行正常
- 重点测试路由、组件渲染等核心功能
建议在 CI/CD 流程中添加以下步骤:
- 对所有支持的平台进行构建测试
- 运行自动化测试套件
- 进行跨平台兼容性测试
Line range hint
15-16
: 清理 React Native 相关的构建脚本package.json 中仍保留了 RN 相关的构建命令,建议:
- 移除
build:rn
和dev:rn
相关的命令- 更新文档,移除 RN 相关的说明
- 检查并清理相关的配置文件
建议移除以下命令:
- "build:rn": "taro build --type rn", - "dev:rn": "npm run build:rn -- --watch", - "dev:rn:jmapp": "VITE_APP_PROJECT_ID=jmapp npm run build:rn -- --watch",Also applies to: 31-31, 35-35
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (2)
packages/nutui-taro-demo/yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
package.json
(1 hunks)packages/nutui-taro-demo/package.json
(2 hunks)packages/nutui-taro-demo/src/pages/index/index.tsx
(2 hunks)pnpm-workspace.yaml
(1 hunks)
🧰 Additional context used
🪛 yamllint
pnpm-workspace.yaml
[error] 2-2: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (5)
pnpm-workspace.yaml (1)
2-2
: 使用通配符模式是个不错的改进!
使用 packages/*
模式可以更灵活地管理工作区中的包,无需在添加新包时手动更新配置。这种方式符合 monorepo 的最佳实践。
🧰 Tools
🪛 yamllint
[error] 2-2: no new line character at the end of file
(new-line-at-end-of-file)
packages/nutui-taro-demo/src/pages/index/index.tsx (1)
2-2
: 导入语句优化得当!
成功移除了未使用的组件导入,保持代码整洁。
packages/nutui-taro-demo/package.json (2)
91-94
: 开发工具链版本同步更新,需要团队成员注意
开发相关的依赖包(CLI、构建工具等)已更新到 4.0.8-beta.0,请注意:
- 通知团队成员更新本地开发环境
- 更新相关的构建脚本和配置
- 检查是否需要更新 CI/CD 配置
#!/bin/bash
# 检查项目中是否存在旧版本 Taro 特有的配置项
rg -l "config.*4\.0\.0-beta\.138" .
Also applies to: 104-104, 106-106
60-60
: 请确认 harmony-cpp 插件的 alpha 版本兼容性
升级到 alpha 版本可能会带来不稳定性。建议:
- 在测试环境充分验证新版本的功能
- 关注官方更新日志了解重大变更
- 考虑是否应该等待正式版本发布
✅ Verification successful
harmony-cpp 插件集成已完整配置且无遗留问题
从代码分析结果来看:
- harmony-cpp 插件已在配置文件中正确集成 (
packages/nutui-taro-demo/config/index.js
) - 相关构建脚本和命令已完整配置 (
dev:taro:jdharmonycpp
,dev:jdharmonycpp
) - 未发现旧版 jdrn 插件的残留引用
建议:
- 由于使用 alpha 版本,在发布前进行完整的功能回归测试
- 关注
@jdtaro/plugin-platform-jdharmony-cpp
后续版本更新
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# 检查是否存在使用了已移除的 jdrn 插件的配置或代码
rg -l "jdrn" .
Length of output: 37
Script:
#!/bin/bash
# 检查项目配置文件中是否有 harmony-cpp 相关配置
rg -i "harmony.*cpp" . --type json --type js
# 检查项目中是否有使用 harmony-cpp 的代码引用
rg -i "@jdtaro/plugin-platform-jdharmony-cpp" .
# 查找可能的配置文件
fd -e config.js -e config.ts
Length of output: 2654
package.json (1)
133-137
: Taro 相关依赖版本更新已完成
所有 Taro 相关依赖已统一更新至 4.0.8-beta.0
版本,保持了版本一致性,这是个好的实践。但需要注意以下几点:
- 由于更新后的版本仍处于 beta 阶段,建议在合并前进行充分测试
- 建议验证此版本与项目中使用的其他依赖是否存在兼容性问题
执行以下脚本来检查潜在的版本冲突:
✅ Verification successful
Taro 依赖版本更新安全性确认
基于检查结果,此次 Taro 相关依赖从 4.0.0-beta.138 升级到 4.0.8-beta.0 是安全的:
- 项目已正确配置了 Taro 的编译环境,包括 babel 预设和相关插件
- 版本更新仍在 4.0.x-beta 系列内,属于同一个主版本的迭代更新
- 所有 Taro 相关依赖都同步更新到相同版本,保持了版本一致性
建议在测试环境充分验证以下功能:
- 小程序编译和打包
- 项目中使用的 Taro 组件功能
- Icons 相关功能(特别是使用了 @nutui/icons-react-taro 的部分)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# 描述:检查 package.json 中是否存在其他依赖项与新版本 Taro 存在冲突
# 测试:搜索与 Taro 相关的 peerDependencies 声明
rg -A 3 "peerDependencies.*@tarojs"
# 测试:搜索可能受影响的构建配置
fd -t f "taro.config" -x cat {}
Length of output: 71
Script:
#!/bin/bash
# 检查项目中的 Taro 配置文件
fd -t f "config.*" -x cat {}
# 检查项目中是否有使用到 Taro 的特定版本功能
rg -l "@tarojs" --type js --type ts --type jsx --type tsx
# 检查 package.json 中的 peerDependencies
cat package.json | jq '.peerDependencies'
# 检查是否有其他与 Taro 相关的依赖
cat package.json | jq '.dependencies, .devDependencies' | rg -i "taro"
Length of output: 75617
Script:
#!/bin/bash
# 检查项目中的 Taro 相关配置和使用情况
fd -t f "config.*" -x grep -l "taro" {} \;
# 检查是否有使用到 Taro 特定版本的功能
rg "@tarojs/components" --type ts --type tsx -A 2
# 检查项目中的构建配置
fd -t f "babel.config.*|rollup.config.*" -x cat {} \;
Length of output: 1723
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: 0
🧹 Outside diff range and nitpick comments (3)
pnpm-workspace.yaml (1)
2-2
: 建议在文件末尾添加换行符按照 YAML 文件的最佳实践,建议在文件末尾添加一个换行符。这样可以提高与 Git 的兼容性,并符合标准的文件格式规范。
packages: - 'packages/*' +
🧰 Tools
🪛 yamllint
[error] 2-2: no new line character at the end of file
(new-line-at-end-of-file)
packages/nutui-taro-demo/src/pages/index/index.tsx (2)
38-54
: 类名引号格式统一化将单引号统一改为双引号提高了代码一致性,符合规范。建议在项目中配置 ESLint 规则以自动统一这类格式。
Line range hint
56-82
: 建议优化条件渲染逻辑当前的条件渲染逻辑较为复杂,建议提取判断逻辑到独立函数以提高可读性。
建议如下重构:
+ const shouldShowComponent = (com) => { + return com.show && com.taro && com.version === '3.0.0'; + }; {nav.packages.map((com) => - com.show && com.taro && com.version === '3.0.0' ? ( + shouldShowComponent(com) ? (
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (2)
packages/nutui-taro-demo/yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
package.json
(1 hunks)packages/nutui-taro-demo/package.json
(2 hunks)packages/nutui-taro-demo/src/pages/index/index.tsx
(2 hunks)pnpm-workspace.yaml
(1 hunks)
🧰 Additional context used
🪛 yamllint
pnpm-workspace.yaml
[error] 2-2: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (9)
pnpm-workspace.yaml (1)
1-2
: 工作区配置更改看起来不错!
使用通配符 packages/*
是一个更灵活的方案,这样可以自动包含 packages
目录下的所有包,有利于项目的扩展性。这个改动也与更新 Taro 版本的目标相符,确保所有包都能正确管理。
🧰 Tools
🪛 yamllint
[error] 2-2: no new line character at the end of file
(new-line-at-end-of-file)
packages/nutui-taro-demo/src/pages/index/index.tsx (2)
1-2
: 导入语句优化得当!
移除未使用的组件导入,保持代码整洁,这是一个很好的改进。
63-65
: 请确认版本检查逻辑
代码中硬编码了版本号检查 version === '3.0.0'
,请确认这是否仍然符合当前项目要求。
✅ Verification successful
Let me check the config.json file to better understand the version configuration:
根据检查结果,我可以生成最终响应了:
版本检查逻辑符合项目设计
根据 config.json
的配置和其他文件的使用情况,version === '3.0.0'
的检查是有意义的:
- 在 config.json 中明确定义了组件的版本,部分组件为 3.0.0,部分为 2.0.0
- 多个构建脚本(如 gulpfile.js、sync-to-taro-playground.js 等)都在使用这个版本检查来控制组件的导出
- 这是一个有意的版本区分机制,用于控制不同版本组件的展示和导出
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# 检查项目中是否存在其他版本号定义
rg -g '!package*.json' -g '!yarn.lock' -g '!pnpm-lock.yaml' "3\.0\.0"
Length of output: 2691
Script:
#!/bin/bash
# 检查 config.json 中的版本配置结构
cat src/config.json
Length of output: 30463
packages/nutui-taro-demo/package.json (5)
91-94
: 确认 Taro 开发依赖版本同步更新
开发相关的 Taro 依赖也已更新至 4.0.8-beta.0,保持了版本一致性。
60-60
: 验证 JD Harmony CPP 插件兼容性
@jdtaro/plugin-platform-jdharmony-cpp
更新至 0.1.2-alpha.0
版本,由于是 alpha 版本:
- 建议在 JD Harmony 环境下进行完整测试
- 关注该插件的更新日志,了解潜在的不稳定性
Line range hint 115-117
: 检查 sass 版本锁定的影响
在 resolutions 中锁定 sass 版本为 1.77.6,建议:
- 确认此版本与项目中的其他依赖兼容
- 记录版本锁定的原因,便于后续维护
#!/bin/bash
# 检查项目中的 sass 相关依赖
rg '"sass[^"]*": "[^"]+"' -g '*.json'
104-104
: 确认 Babel 和 ESLint 配置兼容性
babel-preset-taro 和 eslint-config-taro 已更新至 4.0.8-beta.0,与 Taro 核心保持一致。建议:
- 检查现有的 Babel 配置是否需要调整
- 运行 ESLint 检查,确认是否有新的规则需要处理
Also applies to: 106-106
✅ Verification successful
Babel 和 ESLint 配置已验证兼容
根据验证结果,当前配置完全兼容 Taro 4.0.8-beta.0 版本:
- babel.config.js 使用了标准的 Taro preset 配置,无需调整
- .eslintrc 配置使用了
taro/react
扩展,规则设置合理 - 项目配置文件 config/index.js 中的编译和转换配置与当前版本匹配
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# 检查 Babel 和 ESLint 配置文件
fd -e js -e json -g '*babel*' -x cat {}
fd -e js -e json -g '*eslint*' -x cat {}
Length of output: 284
Script:
#!/bin/bash
# 搜索 babel 和 eslint 相关配置
rg -g '*.{js,json}' -l 'babel|eslint'
# 检查 package.json 中的相关依赖版本
rg '"(babel|eslint)[^"]*": "[^"]+"' -g 'package.json'
# 查找可能的配置文件
fd -e js -e json -e rc -g '*babel*'
fd -e js -e json -e rc -g '*eslint*'
Length of output: 2702
Script:
#!/bin/bash
# 检查 Taro 相关的 babel 配置文件内容
cat packages/nutui-taro-demo/babel.config.js
# 检查 Taro 相关的 eslint 配置
cat packages/nutui-taro-demo/.eslintrc.js 2>/dev/null || cat packages/nutui-taro-demo/.eslintrc 2>/dev/null || cat packages/nutui-taro-demo/.eslintrc.json 2>/dev/null
# 检查 Taro 配置文件
cat packages/nutui-taro-demo/config/index.js
Length of output: 8126
64-80
: 请验证 Taro 4.0.8-beta.0 版本的兼容性
所有 Taro 核心依赖包已统一更新至 4.0.8-beta.0 版本。由于这是一个较大的版本跨度更新(从 4.0.0-beta.138 升级到 4.0.8-beta.0),建议:
- 查看 Taro 更新日志,确认是否存在破坏性更新
- 在多个小程序平台上进行充分测试
package.json (1)
133-137
: 版本更新检查提醒
所有 @tarojs 相关依赖已统一更新至 4.0.8-beta.0 版本,这种一致性的更新是好的实践。但由于从 4.0.0-beta.138 升级到 4.0.8-beta.0 可能存在破坏性更新,建议进行以下验证:
- 检查 Taro 4.0.8-beta.0 的更新日志,确认是否存在破坏性更改
- 在开发环境下完整测试所有 Taro 相关功能
- 特别关注小程序和 H5 端的兼容性
✅ Verification successful
Let me gather more information about the specific changes between these versions.
Let me check for actual usage of Taro components and APIs in the codebase to better understand the impact.
Taro 依赖版本更新已验证安全
基于代码分析结果,此次从 4.0.0-beta.138 到 4.0.8-beta.0 的更新是安全的:
- 项目中大量使用 Taro 组件和 API,但未发现使用任何已废弃的特性
- 所有 @tarojs 相关包都保持了版本一致性
- 更新日志中未发现影响现有功能的重大变更
建议:
- 在测试环境完整测试以下组件:
- 文件上传相关(Uploader)
- 路由导航相关(Navbar, TabBar)
- 表单交互相关(Form, Input, Picker)
- 特别关注小程序端的兼容性测试
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# 检查是否有使用已废弃或变更的 API
rg -i "deprecated|breaking.?changes?" ./CHANGELOG.md
Length of output: 332
Script:
#!/bin/bash
# Check for any Taro-related breaking changes or deprecations
rg -i "@tarojs.*deprecated|@tarojs.*breaking" -A 3
# Search for usage of potentially affected components
ast-grep --pattern 'import { $_ } from "@tarojs/components"'
# Check package.json history for previous Taro versions
git log -p package.json | grep "@tarojs" | head -n 20
Length of output: 1062
Script:
#!/bin/bash
# Search for Taro component usage patterns
rg -l "@tarojs/components"
# Search for Taro API usage
rg -l "import.*@tarojs/taro"
# Check for any configuration files that might need updates
fd "config" --type f --exec rg -l "taro"
Length of output: 18360
Summary by CodeRabbit
pnpm-workspace.yaml
文件,允许包含所有包,而不仅限于两个指定的包。