ci: update ci#18570
Conversation
概览在 GitHub 工作流中添加了条件化的构建步骤,根据操作系统选择不同的 npm 脚本,并在 package.json 中引入了一个新的串行构建脚本以支持单并发工作区构建。 变更
序列图sequenceDiagram
participant CI as GitHub Actions
participant Workflow as nodejs.yml
participant Build as Build Script
CI->>Workflow: 触发工作流
Workflow->>Workflow: 检测操作系统
alt Windows
Workflow->>Build: 执行 pnpm build:serial<br/>(--workspace-concurrency=1)
else 其他系统
Workflow->>Build: 执行 pnpm build<br/>(默认并发)
end
Note over Build: NODE_OPTIONS=<br/>--max_old_space_size=4096
Build->>Build: 构建工作区
代码审查工作量评估🎯 1 (简单) | ⏱️ ~5 分钟
建议的审查者
诗歌
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18570 +/- ##
========================================
Coverage 55.97% 55.97%
========================================
Files 416 416
Lines 21563 21563
Branches 5299 5287 -12
========================================
Hits 12070 12070
+ Misses 8013 7878 -135
- Partials 1480 1615 +135
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/nodejs.yml(1 hunks)package.json(1 hunks)packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json(1 hunks)packages/taro-rn/src/lib/index.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/nodejs.yml
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ianzone
Repo: NervJS/taro PR: 18150
File: packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json:2356-2356
Timestamp: 2025-08-25T22:16:50.118Z
Learning: The file `packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json` is auto-generated by the post-build script `packages/taro-platform-h5/scripts/post-build.mjs`, which copies content from `taro-platform-h5/dist/definition.json`. This file should not be manually edited.
Learnt from: ianzone
Repo: NervJS/taro PR: 18146
File: packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json:12-14
Timestamp: 2025-08-08T02:32:58.265Z
Learning: 在 Taro 项目的 pnpm 工作区中,Vitest 相关依赖(vitest 和 vitest/coverage-istanbul)被管理在根目录的 package.json 中,而不是各个子包的 devDependencies 中。这是 monorepo 中依赖提升的标准做法。
Learnt from: ianzone
Repo: NervJS/taro PR: 17746
File: packages/taro-runtime/tsdown.config.ts:10-16
Timestamp: 2025-05-25T18:02:31.387Z
Learning: 在 taro-runtime 包的 tsdown 配置中,必须禁用 treeshake 来保留 dom-external/index.js 文件。
Learnt from: ianzone
Repo: NervJS/taro PR: 17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
📚 Learning: 2025-08-25T22:16:50.118Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18150
File: packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json:2356-2356
Timestamp: 2025-08-25T22:16:50.118Z
Learning: The file `packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json` is auto-generated by the post-build script `packages/taro-platform-h5/scripts/post-build.mjs`, which copies content from `taro-platform-h5/dist/definition.json`. This file should not be manually edited.
Applied to files:
packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json
📚 Learning: 2025-08-08T02:32:58.265Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18146
File: packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json:12-14
Timestamp: 2025-08-08T02:32:58.265Z
Learning: 在 Taro 项目的 pnpm 工作区中,Vitest 相关依赖(vitest 和 vitest/coverage-istanbul)被管理在根目录的 package.json 中,而不是各个子包的 devDependencies 中。这是 monorepo 中依赖提升的标准做法。
Applied to files:
package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
- 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-unknown-linux-gnu
- GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
- GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
- GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
🔇 Additional comments (2)
package.json (1)
24-24: LGTM!新增的
build:serial脚本通过--workspace-concurrency=1强制串行构建,这对于解决 CI 环境中的资源限制问题(如内存不足)是合理的做法。脚本定义正确,与 PR 目标一致。packages/taro-rn/src/lib/index.ts (1)
2-2: 该审查意见不正确
ENV_TYPE导出位于第 2 行是getLibList.js脚本正确生成的结果,而非手动修改。验证结果显示:
ENV_TYPE是packages/taro-rn/src/lib/目录中的第一个子目录getLibList.js通过readdirSync()读取目录并按文件系统顺序生成导出语句- 当前
index.ts中的导出顺序(ENV_TYPE → arrayBufferToBase64 → authorize...)完全符合readdirSync()返回的顺序,不按字母表排序- 此顺序与脚本生成逻辑一致,无需修改脚本或重新生成文件
Likely an incorrect or invalid review comment.
| "type": "Type" | ||
| }, | ||
| "image": { | ||
| "lang": "string", |
There was a problem hiding this comment.
🧩 Analysis chain
确认此更改是否由构建脚本生成
根据项目记录,此文件由 packages/taro-platform-h5/scripts/post-build.mjs 自动生成,不应手动编辑。请确认:
- 如果是手动添加
lang字段,应当在源文件taro-platform-h5中的定义更新,然后重新运行构建脚本 - 如果已在源文件中更新并运行了构建脚本,则此更改是正确的
基于学习记录
运行以下脚本验证源文件是否已更新:
🏁 Script executed:
#!/bin/bash
# 检查 taro-platform-h5 中 image 组件的 lang 字段定义
# 查找 image 组件定义中的 lang 字段
rg -n -A3 -B3 '"lang"' packages/taro-platform-h5/Length of output: 0
需要进一步验证。由于在源目录中未找到 lang 字段,我需要检查构建脚本和源文件的实际结构。
🏁 Script executed:
#!/bin/bash
# 1. 查找 post-build.mjs 脚本位置和内容
echo "=== 查找 post-build.mjs ==="
find packages/taro-platform-h5/ -name "post-build.mjs" -o -name "post-build.js"
# 2. 查看 taro-platform-h5 目录结构
echo -e "\n=== taro-platform-h5 目录结构 ==="
ls -la packages/taro-platform-h5/ 2>/dev/null | head -20
# 3. 查找 image 组件相关定义文件
echo -e "\n=== 查找 image 相关定义文件 ==="
fd -t f "image" packages/taro-platform-h5/ | grep -E "\.(ts|js|json)$" | head -20
# 4. 查找 definition 相关文件
echo -e "\n=== 查找 definition 文件 ==="
fd "definition" packages/taro-platform-h5/Length of output: 1009
🏁 Script executed:
#!/bin/bash
# 1. 检查源文件 definition.json 中是否存在 lang 字段
echo "=== 源文件 definition.json 中的 lang 字段 ==="
rg -n '"lang"' packages/taro-platform-h5/definition/definition.json
# 2. 查看 image 组件在源文件中的定义
echo -e "\n=== 源文件中 image 组件的 lang 字段 ==="
rg -n -A5 -B5 '"image"' packages/taro-platform-h5/definition/definition.json | head -40
# 3. 查看 post-build.mjs 脚本内容
echo -e "\n=== post-build.mjs 脚本内容 ==="
cat packages/taro-platform-h5/scripts/post-build.mjs
# 4. 检查生成的文件 h5-definition.json 中 lang 字段周围的内容
echo -e "\n=== 生成的文件中 lang 字段附近的内容 ==="
rg -n -B5 -A5 '"lang": "string"' packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json | head -30Length of output: 1404
🏁 Script executed:
#!/bin/bash
# 检查构建后的 dist/definition.json 中 image 组件的定义
echo "=== dist/definition.json 中 image 组件的定义 ==="
if [ -f "packages/taro-platform-h5/dist/definition.json" ]; then
rg -n -B5 -A5 '"image"' packages/taro-platform-h5/dist/definition.json | head -30
else
echo "dist/definition.json 不存在,需要构建"
fi
# 检查 git diff 以确认哪些文件被修改
echo -e "\n=== git diff 中关于 h5-definition.json 的变化 ==="
git diff HEAD packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json | grep -A3 -B3 '"lang"' | head -20Length of output: 117
应在源文件中添加 lang 字段定义,而不是直接修改 mock 文件
当前问题:
lang字段已手动添加到packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json(第2192行)- 但源文件
packages/taro-platform-h5/definition/definition.json中的 image 组件并不包含此字段(仅有 lazyLoad, mode, nativeProps, src) - 根据项目规则,mock 文件由
post-build.mjs脚本自动生成,不应手动编辑 - 下次运行构建脚本后,此手动添加的字段将丢失
修复步骤:
- 在
packages/taro-platform-h5/definition/definition.json的 image 组件中添加"lang": "string"定义 - 运行项目的构建脚本重新生成 mock 文件
🤖 Prompt for AI Agents
In packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json
around line 2192: the `lang` field was manually added to the mock but must be
added in the source definition; open
packages/taro-platform-h5/definition/definition.json, locate the image component
entry and add "lang": "string" to that component's property definitions, then
run the project's build/post-build script to regenerate the mocks so the change
persists (do not manually edit the mock file).
84cdc51 to
7d2b5e0
Compare
7d2b5e0 to
f3c2c8b
Compare
|
更新CI能不能把node版本也更新一下 #17905 |
这个感觉得跟node最低版本这个一起变更,后面再搞吧 |
这个 PR 做了什么? (简要描述所做更改)
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit
发布说明