-
Notifications
You must be signed in to change notification settings - Fork 4.9k
chore: add nx #17842
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
base: main
Are you sure you want to change the base?
chore: add nx #17842
Conversation
Walkthrough本次变更主要围绕引入和配置 Nx 构建系统,包括新增 nx.json、调整 package.json 脚本、添加 nx 依赖、完善 .gitignore 及 VSCode 配置,并对 GitHub Actions 工作流进行优化,增加缓存机制和合并后自动上传缓存的流程。同时引入了用于修复 Nx 缓存的脚本,并对部分平台定义和依赖进行了细微调整。 Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant Nx CLI
participant fix-nx-cache.mjs
participant Nx Daemon
participant FileSystem
Developer->>Nx CLI: 运行 build/test/updateSnapshot 脚本
Nx CLI->>FileSystem: 读取 nx.json 配置
Nx CLI->>Nx Daemon: 启动/停止 Daemon
Nx CLI->>FileSystem: 读写 .nx 缓存
Developer->>fix-nx-cache.mjs: 执行缓存修复脚本
fix-nx-cache.mjs->>Nx Daemon: 停止 Daemon
fix-nx-cache.mjs->>FileSystem: 备份 .db 文件
fix-nx-cache.mjs->>Nx CLI: 执行 clean 生成新 db
fix-nx-cache.mjs->>Nx Daemon: 再次停止 Daemon
fix-nx-cache.mjs->>FileSystem: 删除新 .db,恢复旧 .db
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15-25 minutes Suggested reviewers
Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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
🧹 Nitpick comments (4)
.gitignore (1)
87-89: 建议明确忽略目录
当前对.nx/cache和.nx/workspace-data的忽略模式已生效,但推荐在行末添加斜杠以示意要忽略目录(例如.nx/cache/和.nx/workspace-data/),或者简化为忽略整个.nx/目录:-.nx/cache -.nx/workspace-data +.nx/.vscode/settings.json (1)
24-25: 补充插件依赖及文档说明
引入"nxConsole.generateAiAgentRules": true依赖于 Nx Console 扩展,请在项目文档(README 或 CONTRIBUTING)中说明该依赖,并提供如何安装和启用此插件的使用指南。nx.json (1)
8-23: 建议集中管理可缓存操作
当前在每个targetDefaults中都配置了cache: true。可考虑在nx.json中通过tasksRunnerOptions.default.options.cacheableOperations全局声明要缓存的任务列表,从而简化维护并提升可读性。.github/instructions/nx.instructions.md (1)
5-6: 使用 Markdown 注释语法
文件中出现了// This file is automatically generated by Nx Console,建议改用 Markdown 内置的 HTML 注释形式:<!-- This file is automatically generated by Nx Console -->以保持文档一致性。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
.github/instructions/nx.instructions.md(1 hunks).gitignore(1 hunks).vscode/mcp.json(1 hunks).vscode/settings.json(1 hunks)nx.json(1 hunks)package.json(4 hunks)
🧰 Additional context used
🪛 LanguageTool
.github/instructions/nx.instructions.md
[misspelling] ~7-~7: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...lly generated by Nx Console You are in an nx workspace using Nx 21.1.3 and pnpm a...
(EN_A_VS_AN)
[misspelling] ~14-~14: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...iguration - If the user needs help with an Nx configuration or project graph error...
(EN_A_VS_AN)
[style] ~35-~35: Consider using a different verb for a more formal wording.
Context: ...' to see what's wrong and help the user fix their problem. Use the appropriate tool...
(FIX_RESOLVE)
[uncategorized] ~37-~37: Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short).
Context: ...n the task. This task is already running and the user can see the output in the term...
(COMMA_COMPOUND_SENTENCE_2)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
- GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
- GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
- GitHub Check: Testing on Rust
🔇 Additional comments (7)
.vscode/mcp.json (1)
1-8: 确认 VSCode 扩展配置生效
该文件定义了名为 “nx-mcp” 的 HTTP 服务器配置,请确保团队在 VSCode 中已安装并启用对应的插件(如 REST Client、Nx Console 等),以便正确加载此自定义服务器。nx.json (1)
1-7: 评估跨平台运行时检查兼容性
在namedInputs.sharedGlobals中使用node --version和pnpm --version作为运行时输入,建议确认这些命令在 Windows、macOS 和 Linux 环境下一致可用,或考虑统一调用方式。.github/instructions/nx.instructions.md (1)
1-3: 检查 YAML Frontmatter 语法
第一行使用了三个短横线和applyTo: '**',请确认该 Frontmatter 格式可被目标工具正确解析。package.json (4)
23-23: 确认build脚本与 Nx 配置一致
请确保在nx.json或各项目配置中已声明prod目标,否则执行nx run-many -t prod时会失败。
33-33: 验证test:ci任务在 Nx 中定义
请检查nx.json或工作区项目是否包含名为test:ci的任务,以免nx run-many -t test:ci找不到目标。
35-35: 确认updateSnapshot任务配置完备
nx run-many -t updateSnapshot应对应相应的目标,请核实工作区中已正确声明并配置此任务。
145-145: 新增nx依赖版本审查
已将nx添加为 devDependency,版本号^21.1.3是否与当前工作区和插件兼容?请验证并确认无后向兼容性问题。
Codecov ReportAttention: Patch coverage is
❌ Your project check has failed because the head coverage (56.72%) is below the target coverage (75.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #17842 +/- ##
==========================================
+ Coverage 55.90% 56.72% +0.82%
==========================================
Files 417 197 -220
Lines 21693 5682 -16011
Branches 5376 1236 -4140
==========================================
- Hits 12127 3223 -8904
+ Misses 7935 2270 -5665
+ Partials 1631 189 -1442
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Taro的大佬们都去弄鸿蒙了😂 |
|
npmjs 居然宕机了。 |
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/nodejs.yml(3 hunks)nx.json(1 hunks)packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json(2 hunks)packages/taro-rn/src/lib/index.ts(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json
- packages/taro-rn/src/lib/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/nodejs.yml
🧰 Additional context used
🪛 Biome (1.9.4)
nx.json
[error] 2-2: Expected a property but instead found '// https://nx.dev/reference/nx-json'.
Expected a property here.
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-4: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-5: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-5: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-9: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 9-9: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-10: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-10: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-25: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 25-26: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Build Rust Binding / stable - aarch64-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 - x86_64-apple-darwin
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
🔇 Additional comments (3)
nx.json (3)
10-25: 验证目标(target)名称与项目脚本匹配
已为prod、test:ci和updateSnapshot定义默认输入、依赖和缓存策略,需确保各个子项目(project.json 或 workspace.json)中存在对应的 target,并且package.json中调用nx run-many --target=XXX的脚本名称一致,否则缓存与依赖关系配置将不会生效。🧰 Tools
🪛 Biome (1.9.4)
[error] 10-10: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 10-10: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 10-25: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
26-27: 文件尾的闭合括号和空行无需额外评论。
1-4:❓ Verification inconclusive
留意 JSON 注释与工具解析错误
当前文件使用了//注释,纯 JSON 格式并不支持,这会导致 Biome 等静态分析工具报错。请确认仓库是否将nx.json当作 JSONC 解析,或将其重命名为.jsonc;否则需移除注释或在工具配置中忽略该文件。
确认 nx.json 注释兼容性
nx.json默认使用 JSONC 解析器,支持保留//注释,无需重命名;
- 请核实 Biome 等静态分析/格式化工具对
.json注释的兼容性- 若工具不支持,可在其配置中将
nx.json识别为 JSONC,或移除/迁移注释以避免错误🧰 Tools
🪛 Biome (1.9.4)
[error] 2-2: Expected a property but instead found '// https://nx.dev/reference/nx-json'.
Expected a property here.
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-4: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
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
🧹 Nitpick comments (1)
packages/taro-runtime/jest.config.js (1)
16-18: 硬编码文件路径易增加维护成本,可考虑使用rootDir或统一别名
将映射改为.../dist/runtime.js虽能精确定位,但直接在各包的 Jest 配置里写死长路径会带来两点隐患:
- 项目目录层级变动或包名调整时需要逐一修改。
- 多处配置散落,难以统一变更,且 Nx 缓存规则对路径十分敏感,稍有不一致就可能导致缓存失效。
建议:
- '@tarojs/plugin-framework-vue3/dist/runtime': path.resolve(__dirname, '..', '..', 'packages/taro-framework-vue3/dist/runtime.js'), + '^@tarojs/plugin-framework-vue3/dist/runtime$': '<rootDir>/../taro-framework-vue3/dist/runtime.js',
- 使用
<rootDir>(Jest 内置,等价于当前包根)避免path.resolve。- 为保持一致性,可将所有包的
moduleNameMapper抽到 monorepo 根部的共享 Jest 基础配置,再通过extends引用,降低重复。- 若
runtime.js为 ES 模块,需确认transformIgnorePatterns不会跳过该文件,否则请在根配置里为其添加转译规则。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (1)
packages/taro-runtime/jest.config.js(1 hunks)
⏰ 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 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
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
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
🧹 Nitpick comments (1)
packages/babel-plugin-transform-taroapi/jest.config.ts (1)
14-16: 建议将键名改为完整正则,避免误匹配
目前键名包含.和/,Jest 会按正则处理,若后续有更长路径前缀,可能被错误命中。- '@tarojs/plugin-platform-h5/dist/definition.json': resolve(__dirname, '..', 'taro-platform-h5/dist/definition.json') + '^@tarojs/plugin-platform-h5/dist/definition\\.json$': resolve(__dirname, '..', 'taro-platform-h5', 'dist', 'definition.json')顺带把
resolve的第三个参数拆分为多段,保持跨平台一致性。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (1)
packages/babel-plugin-transform-taroapi/jest.config.ts(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- 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
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-musl
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
🔇 Additional comments (1)
packages/babel-plugin-transform-taroapi/jest.config.ts (1)
1-1: 引入node:path的做法正确且符合 Node 18+ 规范
直接从node:命名空间导入可避免路径被打包工具错误解析,👍
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
🧹 Nitpick comments (2)
nx.json (2)
2-4: 配置文件建议重命名为nx.jsonc以支持注释
当前文件中使用了 JSON 注释(//),这会导致一些严格的 JSON 校验工具(如 Biome)报错。因为 Nx 支持 JSONC,可以考虑将文件重命名为nx.jsonc并在需要的地方更新引用,或在 Biome 配置中排除此文件以消除噪音。🧰 Tools
🪛 Biome (1.9.4)
[error] 2-2: Expected a property but instead found '// https://nx.dev/reference/nx-json'.
Expected a property here.
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-4: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
22-25: 考虑为updateSnapshot添加outputs
当前updateSnapshot未指定outputs,可能导致缓存策略捕获不到更新的快照文件或导致缓存命中不准确。建议根据项目实际快照输出路径(如__snapshots__)补充outputs。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
.github/workflows/nodejs.yml(3 hunks)nx.json(1 hunks)package.json(4 hunks)packages/taro-components/package.json(1 hunks)packages/taro-runtime/jest.config.js(1 hunks)packages/taro-runtime/src/__tests__/vue.spec.js(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/taro-runtime/src/tests/vue.spec.js
🚧 Files skipped from review as they are similar to previous changes (4)
- .github/workflows/nodejs.yml
- packages/taro-components/package.json
- packages/taro-runtime/jest.config.js
- package.json
🧰 Additional context used
🧠 Learnings (1)
nx.json (1)
Learnt from: ianzone
PR: NervJS/taro#17842
File: nx.json:5-9
Timestamp: 2025-06-13T09:59:26.432Z
Learning: 在 Nx 的 nx.json 中,命名输入组之间的引用可以直接写字符串(如 "sharedGlobals"、"default"),不需要使用 "#" 等前缀。
🪛 Biome (1.9.4)
nx.json
[error] 2-2: Expected a property but instead found '// https://nx.dev/reference/nx-json'.
Expected a property here.
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-4: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-5: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-5: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-9: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 9-9: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-10: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-10: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-26: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 26-27: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-musl
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
- GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
- GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
🔇 Additional comments (3)
nx.json (3)
5-9: 确认namedInputs引用语法正确
根据 Nx 官方文档(v21+),在namedInputs中直接使用命名组(如"sharedGlobals"、"default")即可正确引用,无需前缀"#"。已符合规范,无需更改。🧰 Tools
🪛 Biome (1.9.4)
[error] 5-5: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 5-5: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 5-9: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 9-9: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
10-16:prod目标缓存配置合理
prod目标配置了输入、依赖、缓存和输出,符合最佳实践。outputs指定了dist目录,确保构建产物可被缓存与恢复。🧰 Tools
🪛 Biome (1.9.4)
[error] 10-10: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 10-10: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 10-26: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
17-21: 请确认dependsOn配置
test:ci依赖项使用了"dependsOn": ["prod"],请验证是否应使用["^prod"](含依赖项目的prod任务)来保证跨项目依赖生效,或确实只需当前项目的prod。
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
♻️ Duplicate comments (3)
tests/__tests__/config.spec.ts (3)
119-119: 同上 – 参见行 105 的建议。
192-192: 同上 – 参见行 175 的建议。
225-225: 同上 – 参见行 208 的建议。
🧹 Nitpick comments (3)
tests/__tests__/config.spec.ts (3)
105-105: 使用toHaveBeenCalledWith替换别名是正确做法,但可加次数断言
toHaveBeenCalledWith(true)更直观且官方推荐。不过为了避免误把多次调用也视为通过,可考虑同时断言调用次数:expect(fn).toHaveBeenCalledWith(true) +expect(fn).toHaveBeenCalledTimes(1)
175-175: 校验 include 回调时建议断言参数以提高覆盖率目前只检查“被调用”,但未验证传入的
filename是否符合预期,测试价值有限。可考虑:-expect(include).toHaveBeenCalled() +expect(include).toHaveBeenCalled() +expect(include.mock.calls[0][0]).toContain(sourceRoot) // 示例断言
208-208: 对 exclude 回调同样可断言参数建议和 include 部分保持一致,确认排除逻辑针对正确文件:
-expect(exclude).toHaveBeenCalled() +expect(exclude).toHaveBeenCalled() +expect(exclude.mock.calls[0][0]).toContain(sourceRoot)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
.github/workflows/nodejs.yml(3 hunks)package.json(4 hunks)tests/__tests__/config.spec.ts(7 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- .github/workflows/nodejs.yml
- package.json
⏰ Context from checks skipped due to timeout of 90000ms (6)
- 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-unknown-linux-musl
- 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 WASM / stable - wasm32-wasi
🔇 Additional comments (1)
tests/__tests__/config.spec.ts (1)
2-2: 无需额外动作仅增加空行用于分隔导入,符合常规代码风格。
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
🧹 Nitpick comments (1)
nx.json (1)
2-4: 考虑将文件重命名为 JSONC 以消除 Biome 报错
当前nx.json使用了//注释,Nx 会把它当作 JSONC 正确解析,但 Biome 把它当作纯 JSON 校验并报错。建议可选方案:
- 将文件重命名为
nx.jsonc并同步更新引用;- 在 Biome 配置中排除
nx.json。🧰 Tools
🪛 Biome (1.9.4)
[error] 2-2: Expected a property but instead found '// https://nx.dev/reference/nx-json'.
Expected a property here.
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-4: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
nx.json(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
nx.json (1)
Learnt from: ianzone
PR: NervJS/taro#17842
File: nx.json:5-9
Timestamp: 2025-06-13T09:59:26.456Z
Learning: 在 Nx 的 nx.json 中,命名输入组之间的引用可以直接写字符串(如 "sharedGlobals"、"default"),不需要使用 "#" 等前缀。
🪛 Biome (1.9.4)
nx.json
[error] 2-2: Expected a property but instead found '// https://nx.dev/reference/nx-json'.
Expected a property here.
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-4: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-5: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-5: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-9: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 9-9: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-10: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-10: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-27: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 27-28: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
- GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
- 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-unknown-linux-musl
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
- GitHub Check: Testing on Rust
🔇 Additional comments (2)
nx.json (2)
5-9: 确认命名输入引用符合官方文档
namedInputs中直接使用"sharedGlobals"和"default"即可,按 Nx v21 官方文档,无需加#前缀,配置正确。🧰 Tools
🪛 Biome (1.9.4)
[error] 5-5: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 5-5: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 5-9: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 9-9: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
10-27: 目标默认配置合理
prod、test:ci与updateSnapshot的inputs、dependsOn、缓存及输出路径配置符合预期,能正确驱动 NX 缓存和依赖链。🧰 Tools
🪛 Biome (1.9.4)
[error] 10-10: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 10-10: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 10-27: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
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
🧹 Nitpick comments (2)
nx.json (1)
2-4: 改进建议:将nx.json重命名为nx.jsonc或在 Biome 中排除该文件
当前文件使用了//注释以 JSONC 格式编写,Biome 工具将其当作纯 JSON 校验导致大量误报。建议将文件重命名为nx.jsonc并在相关引用或脚本中更新路径,或在 Biome 配置中排除该文件以消除噪音。🧰 Tools
🪛 Biome (1.9.4)
[error] 2-2: Expected a property but instead found '// https://nx.dev/reference/nx-json'.
Expected a property here.
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-3: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 3-4: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
.github/instructions/nx.instructions.md (1)
5-41: 建议在静态分析工具中排除该目录
.github/instructions目录下的文件为 AI agent 使用的指导文档,包含多种指令和自然语言描述,静态分析工具(如 Biome、LanguageTool)对其中的注释或段落误报较多。建议在相关配置中将该目录排除,以免影响整体 lint 报告。🧰 Tools
🪛 LanguageTool
[misspelling] ~7-~7: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...lly generated by Nx Console You are in an nx workspace using Nx 21.1.3 and pnpm a...(EN_A_VS_AN)
[misspelling] ~14-~14: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...iguration - If the user needs help with an Nx configuration or project graph error...(EN_A_VS_AN)
[style] ~35-~35: Consider using a different verb for a more formal wording.
Context: ...' to see what's wrong and help the user fix their problem. Use the appropriate tool...(FIX_RESOLVE)
[uncategorized] ~37-~37: Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short).
Context: ...n the task. This task is already running and the user can see the output in the term...(COMMA_COMPOUND_SENTENCE_2)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (17)
.github/instructions/nx.instructions.md(1 hunks).github/workflows/build-rust-binding.yml(1 hunks).github/workflows/nodejs.yml(4 hunks).github/workflows/publish.yml(1 hunks).github/workflows/sync-components-types.yml(1 hunks).gitignore(1 hunks).vscode/mcp.json(1 hunks).vscode/settings.json(1 hunks)nx.json(1 hunks)package.json(3 hunks)packages/taro-components/package.json(1 hunks)packages/taro-components/virtual-list/index.d.ts(0 hunks)packages/taro-components/virtual-list/index.js(0 hunks)packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json(2 hunks)packages/taro-rn/src/lib/index.ts(1 hunks)packages/taro-transformer-wx/jest.config.ts(0 hunks)tests/jest.config.ts(0 hunks)
💤 Files with no reviewable changes (4)
- packages/taro-transformer-wx/jest.config.ts
- tests/jest.config.ts
- packages/taro-components/virtual-list/index.js
- packages/taro-components/virtual-list/index.d.ts
✅ Files skipped from review due to trivial changes (1)
- packages/taro-rn/src/lib/index.ts
🚧 Files skipped from review as they are similar to previous changes (10)
- .github/workflows/build-rust-binding.yml
- .vscode/mcp.json
- .gitignore
- .github/workflows/sync-components-types.yml
- .github/workflows/publish.yml
- .vscode/settings.json
- packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json
- .github/workflows/nodejs.yml
- packages/taro-components/package.json
- package.json
🧰 Additional context used
🧠 Learnings (1)
nx.json (1)
Learnt from: ianzone
PR: NervJS/taro#17842
File: nx.json:5-9
Timestamp: 2025-06-13T09:59:26.456Z
Learning: 在 Nx 的 nx.json 中,命名输入组之间的引用可以直接写字符串(如 "sharedGlobals"、"default"),不需要使用 "#" 等前缀。
🪛 LanguageTool
.github/instructions/nx.instructions.md
[misspelling] ~7-~7: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...lly generated by Nx Console You are in an nx workspace using Nx 21.1.3 and pnpm a...
(EN_A_VS_AN)
[misspelling] ~14-~14: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...iguration - If the user needs help with an Nx configuration or project graph error...
(EN_A_VS_AN)
[style] ~35-~35: Consider using a different verb for a more formal wording.
Context: ...' to see what's wrong and help the user fix their problem. Use the appropriate tool...
(FIX_RESOLVE)
[uncategorized] ~37-~37: Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short).
Context: ...n the task. This task is already running and the user can see the output in the term...
(COMMA_COMPOUND_SENTENCE_2)
🪛 Biome (1.9.4)
nx.json
[error] 2-2: Expected a property but instead found '// https://nx.dev/reference/nx-json'.
Expected a property here.
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-4: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-5: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-5: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-9: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 9-9: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-10: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-10: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-27: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 27-28: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
- 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-unknown-linux-musl
- GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
🔇 Additional comments (4)
nx.json (3)
5-9: 命名输入组引用符合官方文档,无需#前缀
namedInputs中直接引用"sharedGlobals"和"default"等组名遵循 Nx v21 官方约定,无需添加#前缀,请忽略相关的历史误导性建议。🧰 Tools
🪛 Biome (1.9.4)
[error] 5-5: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 5-5: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 5-9: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 9-9: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
10-16:prod目标默认配置合理
prod的inputs、dependsOn、cache与outputs设置符合最佳实践,可正确缓存和复用构建产物。🧰 Tools
🪛 Biome (1.9.4)
[error] 10-10: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 10-10: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
[error] 10-27: End of file expected
Use an array for a sequence of values:
[1, 2](parse)
17-21: 校验test:ci任务的依赖与输入配置
当前test:ci目标使用["default","^production"]输入并依赖["prod","^prod"]。请确认这是否匹配预期:测试任务是否需先完成prod构建,或是否应该依赖^test:ci以触发依赖项目的测试?.github/instructions/nx.instructions.md (1)
1-4: 文件头部 Frontmatter 配置正确
当前的 frontmatter (applyTo: '**') 用于指定作用范围,符合 Nx Console AI agent 指令文件的规范,无需修改。
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
🧹 Nitpick comments (1)
packages/taroize/package.json (1)
9-10: 发布文件清单需涵盖所有必需文件(包括类型声明)
当前files仅包含dist目录,需确认该目录下包含编译后的 JS、.d.ts类型声明及其它运行时资源;若未输出声明文件,建议在tsconfig.json中启用declaration并在package.json中添加typings字段指向生成的声明文件。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/rollup-plugin-copy/index.js(0 hunks)packages/rollup-plugin-copy/package.json(1 hunks)packages/rollup-plugin-copy/tsconfig.json(1 hunks)packages/taroize/index.js(0 hunks)packages/taroize/package.json(1 hunks)packages/taroize/tsconfig.json(1 hunks)
💤 Files with no reviewable changes (2)
- packages/taroize/index.js
- packages/rollup-plugin-copy/index.js
✅ Files skipped from review due to trivial changes (3)
- packages/rollup-plugin-copy/tsconfig.json
- packages/taroize/tsconfig.json
- packages/rollup-plugin-copy/package.json
⏰ Context from checks skipped due to timeout of 90000ms (7)
- 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-unknown-linux-musl
- GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
- GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
- GitHub Check: Testing on Rust
🔇 Additional comments (1)
packages/taroize/package.json (1)
7-7: 更新主入口路径,请验证构建产物
已将main从根目录的index.js调整为./dist/src/index.js,请确认执行pnpm run build后该文件确实生成,并且包发布时消费者侧的导入路径保持一致。
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
🧹 Nitpick comments (1)
packages/taro-platform-harmony-cpp/package.json (1)
33-33: 移除--bundleConfigAsCjs需验证打包输出格式将命令改为
rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript后,默认输出格式可能与之前有所不同,建议在rollup.config.ts中显式指定输出格式或插件配置,确保产物兼容预期环境。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/taro-platform-harmony-cpp/package.json(1 hunks)packages/taro-platform-harmony-cpp/rollup.config.ts(2 hunks)packages/taro-platform-harmony-cpp/src/index.ts(1 hunks)packages/taro-platform-harmony-cpp/tsconfig.json(2 hunks)
✅ Files skipped from review due to trivial changes (2)
- packages/taro-platform-harmony-cpp/src/index.ts
- packages/taro-platform-harmony-cpp/rollup.config.ts
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
- 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-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)
packages/taro-platform-harmony-cpp/tsconfig.json (2)
10-10: 确认 TypeScript 支持 moduleResolution "bundler"该选项仅在 TS 5.0+ 中可用,请验证项目中安装的 TypeScript 版本,并确保更改不会影响对 CJS/ESM 模块的正确解析。
21-21: 更新 include 数组,确保 rollup.config.ts 文件路径正确已将
"rollup.config.mts"改为"rollup.config.ts",请确认该文件存在于相对路径下,并且 ts-node/构建脚本能正确加载此配置。
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
🧹 Nitpick comments (1)
packages/taro-platform-harmony/src/program/harmony.ts (1)
15-18: 移除无意义的构造函数
该构造函数仅调用super(ctx, config),并无其他逻辑,建议删除并移除对应的eslint-disable no-useless-constructor注释以减少冗余。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/taro-platform-harmony/src/program/harmony.ts(2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/taro-platform-harmony/src/program/harmony.ts
[error] 16-18: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
⏰ 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 Binding / stable - x86_64-pc-windows-msvc
- 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 WASM / stable - wasm32-wasi
🔇 Additional comments (1)
packages/taro-platform-harmony/src/program/harmony.ts (1)
2-2: 导入类型符合 TS type-only 规范
新增对IPluginContext和TConfig的type导入符合当前项目的类型导入策略,无需调整。
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
🧹 Nitpick comments (1)
packages/taro-platform-harmony-cpp/src/program/vite/inject-env.ts (1)
12-12: 增强健壮性但仍需确保类型安全可选链避免了
this或defineConstants为空时的异常,但.replace仍假设LOCATION_APIKEY一定是字符串。若用户配置成数字或其他类型,仍会在运行时抛错。建议先做类型判断或显式转换后再调用replace。- const businessId = this?.config?.defineConstants?.LOCATION_APIKEY?.replace(/^['"]|['"]$/g, '') + const rawKey = this?.config?.defineConstants?.LOCATION_APIKEY + const businessId = typeof rawKey === 'string' + ? rawKey.replace(/^['"]|['"]$/g, '') + : undefined这样既保证了空值安全,也避免了非字符串类型导致的意外异常。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/taro-platform-harmony-cpp/src/program/vite/inject-env.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- 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 WASM / stable - wasm32-wasi
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: 1
♻️ Duplicate comments (2)
packages/taro-cli/src/__tests__/inspect2.spec.ts (1)
51-58: 与inspect3同样的问题:捕获所有异常导致误报
此处同样存在无差别吞掉异常的问题,建议限制捕获范围或改用expect(...).rejects方式,参考上一文件的修正方案。packages/taro-cli/src/__tests__/inspect1.spec.ts (1)
51-57: 同样的异常吞掉问题
此段逻辑与另两份测试一致,建议统一修正以避免误报。
🧹 Nitpick comments (4)
packages/taro-cli/src/__tests__/inspect3.spec.ts (2)
36-38:beforeEach中同时resetModules与顶层jest.mock的组合存在可读性隐患
jest.resetModules()会清空模块缓存,而顶层jest.mock依赖于 hoist 行为重新生效。虽然逻辑上能够工作,但后续维护者需要理解 Jest 的执行顺序才能确信 mock 仍有效,增加了心智负担。可考虑去掉resetModules(改用jest.clearAllMocks())或将 mock 移至beforeEach里,降低耦合。
57-58: 建议断言调用次数以避免漏测
目前只断言了参数值,未校验调用次数;若process.exit被多次调用测试也会通过。补充调用次数可提升健壮性。expect(exitSpy).toHaveBeenCalledWith(0) +expect(exitSpy).toHaveBeenCalledTimes(1)packages/taro-cli/src/__tests__/inspect2.spec.ts (1)
60-63: 缺少对console.error的断言
已对console.error设置 spy,但未断言其调用情况,导致测试无法保证无错误输出。expect(logSpy).toHaveBeenCalledTimes(1) expect(logSpy).toHaveBeenCalledWith('\'main:h5\'') +expect(errorSpy).not.toHaveBeenCalled()packages/taro-cli/src/__tests__/inspect1.spec.ts (1)
18-29: 提前import { chalk }可能拿到未 mock 实例
jest.mock('@tarojs/helper')被 hoist 后能覆盖大部分导出,但chalk已在文件头引用实际包;若将来需要覆写chalk行为(如禁用颜色)会失效。可改为在 mock 返回值中显式提供chalk,并移除顶层 import:-import { chalk } from '@tarojs/helper' +// const { chalk } = require('@tarojs/helper') // 在需要处按需获取这样 mock 与实际使用保持一致。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/taro-cli/src/__tests__/inspect1.spec.ts(1 hunks)packages/taro-cli/src/__tests__/inspect2.spec.ts(1 hunks)packages/taro-cli/src/__tests__/inspect3.spec.ts(1 hunks)
⏰ 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 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
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
🔇 Additional comments (1)
packages/taro-cli/src/__tests__/inspect1.spec.ts (1)
75-77: 断言结果依赖终端颜色环境
chalk.red()会根据FORCE_COLOR等环境变量输出带或不带 ANSI 码,CI 环境差异可能导致断言失败。可对chalk进行 stub,如返回纯字符串,或使用strip-ansi处理。
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: 1
🧹 Nitpick comments (1)
packages/taro-webpack5-runner/src/webpack/MiniCombination.ts (1)
95-99: 去掉 ESLint 抑制并显式标记未使用变量当前通过
// eslint-disable-line @typescript-eslint/no-unused-vars抑制未使用的clean。
可改为重命名占位符以消除规则抑制,代码更简洁:- const { clean, ...filteredOutput } = output || {} // eslint-disable-line @typescript-eslint/no-unused-vars + const { clean: _unusedClean, ...filteredOutput } = output || {}同时可以去掉整行 ESLint 注释。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
packages/taro-cli/src/__tests__/inspect1.spec.ts(1 hunks)packages/taro-cli/src/__tests__/inspect2.spec.ts(1 hunks)packages/taro-cli/src/__tests__/inspect3.spec.ts(1 hunks)packages/taro-webpack5-runner/src/webpack/MiniBaseConfig.ts(1 hunks)packages/taro-webpack5-runner/src/webpack/MiniCombination.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/taro-cli/src/tests/inspect3.spec.ts
- packages/taro-cli/src/tests/inspect2.spec.ts
- packages/taro-cli/src/tests/inspect1.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-musl
- GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
- GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
- GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
🔇 Additional comments (1)
packages/taro-webpack5-runner/src/webpack/MiniCombination.ts (1)
107-108: 扩展运算符位置合理,允许用户覆盖默认path
...filteredOutput放在最后,可让外部配置覆盖默认输出路径等字段,符合预期,无需调整。
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
🧹 Nitpick comments (3)
.github/instructions/nx.instructions.md (3)
7-7: 修正语法以提高可读性建议修正一些小的语法问题以提高文档质量:
-You are in an nx workspace using Nx 21.2.1 and pnpm as the package manager. +You are in a nx workspace using Nx 21.2.1 and pnpm as the package manager.
14-14: 修正语法一致性-If the user needs help with an Nx configuration or project graph error, use the 'nx_workspace' tool to get any errors +If the user needs help with a Nx configuration or project graph error, use the 'nx_workspace' tool to get any errors
35-35: 使用更正式的表达考虑使用更正式的动词表达:
-Use the terminal output from 'nx_current_running_task_output' to see what's wrong and help the user fix their problem. +Use the terminal output from 'nx_current_running_task_output' to see what's wrong and help the user resolve their problem.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
.github/instructions/nx.instructions.md(1 hunks).pnpmfile.cjs(1 hunks)nx.json(1 hunks)package.json(3 hunks)packages/taro-framework-vue3/package.json(1 hunks)packages/taro-platform-h5/src/program.ts(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- packages/taro-framework-vue3/package.json
- .pnpmfile.cjs
🚧 Files skipped from review as they are similar to previous changes (1)
- package.json
🧰 Additional context used
🧠 Learnings (1)
nx.json (1)
Learnt from: ianzone
PR: NervJS/taro#17842
File: nx.json:5-9
Timestamp: 2025-06-13T09:59:26.456Z
Learning: 在 Nx 的 nx.json 中,命名输入组之间的引用可以直接写字符串(如 "sharedGlobals"、"default"),不需要使用 "#" 等前缀。
🪛 LanguageTool
.github/instructions/nx.instructions.md
[misspelling] ~7-~7: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...lly generated by Nx Console You are in an nx workspace using Nx 21.2.1 and pnpm a...
(EN_A_VS_AN)
[misspelling] ~14-~14: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...iguration - If the user needs help with an Nx configuration or project graph error...
(EN_A_VS_AN)
[style] ~35-~35: Consider using a different verb for a more formal wording.
Context: ...' to see what's wrong and help the user fix their problem. Use the appropriate tool...
(FIX_RESOLVE)
[uncategorized] ~37-~37: Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short).
Context: ...n the task. This task is already running and the user can see the output in the term...
(COMMA_COMPOUND_SENTENCE_2)
🪛 Biome (1.9.4)
nx.json
[error] 2-2: Expected a property but instead found '// https://nx.dev/reference/nx-json'.
Expected a property here.
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-4: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-5: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-5: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 5-9: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 9-9: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-10: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-10: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 10-28: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 28-29: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- 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
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
🔇 Additional comments (3)
packages/taro-platform-h5/src/program.ts (1)
59-61: 显式路径解析改进很好这些更改通过显式添加
/index.js后缀来改进模块解析,避免依赖隐式目录解析。这样可以确保更可靠的模块解析行为,是一个很好的改进。nx.json (1)
1-29: Nx 工作区配置正确这个 Nx 配置文件设置合理:
- 命名输入组定义了
sharedGlobals、default和production的正确范围- 目标默认配置为
prod、test:ci和updateSnapshot提供了适当的输入、依赖、缓存和输出设置- 引用命名输入组的语法正确(直接使用字符串名称,无需前缀)
注意:Biome 的解析错误是误报,因为它将此文件视为纯 JSON,但 Nx 支持 JSONC 格式(允许注释)。
.github/instructions/nx.instructions.md (1)
1-41: 全面的 Nx 工作区指导文档这个指导文档为 Nx 工作区的使用提供了全面的指导方针,包括:
- 通用准则和工具使用建议
- 代码生成的详细流程
- 任务运行的指导原则
文档结构清晰,内容详细,很好地支持了这次 PR 中 Nx 工具链的集成。
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
🧹 Nitpick comments (2)
.github/workflows/nodejs.yml (2)
92-100: 优化 NX 缓存路径粒度以减少体积
当前缓存整个.nx目录会包含临时文件和无关数据,建议只缓存核心子目录:- path: .nx + path: + .nx/cache + .nx/workspace-data
124-129: 考虑后续使用nx affected以提速
目前使用nx run-many会每次全量构建和测试,待解决 moduleNameMapper 循环依赖和 fetch-depth 问题后,可切换到仅针对变更项目的nx affected,进一步优化 CI 性能。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
.github/workflows/nodejs.yml(4 hunks)packages/taro-cli/package.json(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/taro-cli/package.json
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Build Rust Binding / stable - aarch64-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 - x86_64-apple-darwin
- GitHub Check: Build Rust WASM / stable - wasm32-wasi
- GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-musl
🔇 Additional comments (5)
.github/workflows/nodejs.yml (5)
23-25: 新增并发控制,避免重复运行
使用concurrency按 workflow 名称和 ref 进行分组,能在同一分支推送新提交时自动取消旧的流水线,符合预期。
65-66: 确认超时时间是否足够
将整个测试 Job 限制在 20 分钟内可提高反馈速度,但需校验在最慢的 macos-13 和 windows-latest 环境下不会因超时而中断。
69-71: 验证 pnpm/action-setup@v4 兼容性
确保 CI Runner 上已支持 v4 版本 action,且与之前 v3 行为一致,避免因版本差异导致安装或缓存异常。
121-122: 验证pnpm artifacts跨平台执行
默认 Windows CI 使用 PowerShell,需确认该脚本在所有矩阵环境下都可正常运行,或在必要时添加shell: bash。
130-136: NX 缓存保存步骤完善
使用if: ${{ always() }}确保无论前面流程成败都能保存缓存,逻辑合理,无需调整。
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: 1
♻️ Duplicate comments (1)
.github/workflows/merged.yml (1)
27-33: 提升命中率:为 restore 增加前缀回退,并保留“精确复原 PR 头部提交”的特性当前仅按 PR head 的分支与 SHA 精确恢复,若相应缓存不存在将直接 miss。为提高成功率且兼顾“公共缓存预热”,建议增加
restore-keys,并保留你现有的精确 key:- name: 获取最新 NX 缓存 id: latest-nx-cache uses: actions/cache/restore@v4 with: path: .nx - key: ${{ github.event.pull_request.head.ref }}-NX-${{ runner.os }}-${{ matrix.node-version }}-${{ github.event.pull_request.head.sha }} + key: ${{ github.event.pull_request.head.ref }}-NX-${{ runner.os }}-${{ matrix.node-version }}-${{ github.event.pull_request.head.sha }} + restore-keys: | + ${{ github.event.pull_request.head.ref }}-NX-${{ runner.os }}-${{ matrix.node-version }}- + NX-${{ runner.os }}-${{ matrix.node-version }}-这样在精确键未命中时,仍可回退到同分支最近公共缓存,或任意分支的最新公共缓存。
🧹 Nitpick comments (2)
.github/workflows/merged.yml (2)
12-23: 矩阵可简化:已排除全部 macOS/Windows,等价于仅跑 Ubuntu当前
exclude将所有 macOS 与 Windows 组合都排除了,实际只在ubuntu-latest上运行。可简化为直配 Ubuntu,降低认知成本:strategy: matrix: - node-version: [18, 20] - host: [macos-13, windows-latest, ubuntu-latest] - exclude: - - node-version: 18 - host: macos-13 - - node-version: 18 - host: windows-latest - - node-version: 20 - host: macos-13 - - node-version: 20 - host: windows-latest + node-version: [18, 20] + host: [ubuntu-latest]若你是为后续逐步放开平台做准备,也可保留现状,但建议加注释说明原因。
41-41: 文件末尾缺少换行符YAMLlint 报告了 “no new line character at the end of file”。请在文件末尾补一个换行,避免 lint 噪音。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/merged.yml(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: ianzone
PR: NervJS/taro#18146
File: packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json:12-14
Timestamp: 2025-08-08T02:32:58.207Z
Learning: 在 Taro 项目的 pnpm 工作区中,Vitest 相关依赖(vitest 和 vitest/coverage-istanbul)被管理在根目录的 package.json 中,而不是各个子包的 devDependencies 中。这是 monorepo 中依赖提升的标准做法。
📚 Learning: 2025-06-21T19:40:42.482Z
Learnt from: ianzone
PR: NervJS/taro#17842
File: .github/workflows/merged.yml:26-37
Timestamp: 2025-06-21T19:40:42.482Z
Learning: 跨 PR 缓存策略:merge 后的 workflow 可以使用具体缓存键恢复,然后用通用键保存,为后续 PR 构建提供预热缓存。
Applied to files:
.github/workflows/merged.yml
📚 Learning: 2025-07-01T15:46:08.457Z
Learnt from: ianzone
PR: NervJS/taro#17937
File: .github/workflows/issue-labeler.yml:31-31
Timestamp: 2025-07-01T15:46:08.457Z
Learning: stefanbuck/github-issue-parserv3 GitHub Action 的输出字段名称是 `jsonString`,不是 `json`。在工作流中应该使用 `${{ steps.issue-parser.outputs.jsonString }}` 来引用解析后的 JSON 数据。
Applied to files:
.github/workflows/merged.yml
📚 Learning: 2025-06-22T19:04:52.870Z
Learnt from: ianzone
PR: NervJS/taro#17842
File: scripts/fix-nx-cache.mjs:95-109
Timestamp: 2025-06-22T19:04:52.870Z
Learning: 在 Nx workspace cache 的 .nx/workspace-data 目录中,确定只有一个 .db 文件存在,不需要处理多个数据库文件的情况。
Applied to files:
.github/workflows/merged.yml
🪛 YAMLlint (1.37.1)
.github/workflows/merged.yml
[error] 41-41: no new line character at the end of file
(new-line-at-end-of-file)
|
还是先确定一下,NX 这个东西是必须的吗? |
对于一个大型单仓,我认为NX是必须的
|

这个 PR 做了什么? (简要描述所做更改)
利用 nx 缓存加快本地构建及测试过程
这个 PR 是什么类型? (至少选择一个)
Summary by CodeRabbit
新功能
功能优化
依赖调整
其他