-
Notifications
You must be signed in to change notification settings - Fork 4.9k
chore: clean up misc #17910
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: clean up misc #17910
Conversation
|
""" Walkthrough本次变更主要集中于各个包的构建输出目录规范化(由 Changes
Sequence Diagram(s)sequenceDiagram
participant 测试用例
participant Mock定义
participant 插件
测试用例->>Mock定义: 导入 h5-definition.json
测试用例->>插件: 传递 Mock 定义进行测试
插件-->>测试用例: 返回基于 Mock 的测试结果
sequenceDiagram
participant 构建工具
participant 包源码
participant dist目录
构建工具->>包源码: 编译 TypeScript
包源码->>dist目录: 输出 js/d.ts 文件
构建工具-->>dist目录: 仅发布 dist 目录
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings🪛 Biome (1.9.4)packages/taro-platform-harmony-cpp/src/program/vite/inject-env.ts[error] 16-16: This aliasing of this is unnecessary. Arrow functions inherits (lint/complexity/noUselessThisAlias) ⏰ Context from checks skipped due to timeout of 90000ms (3)
🔇 Additional comments (3)
✨ 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. 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 (
|
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: 3
🧹 Nitpick comments (4)
packages/taro-service/src/platform-plugin-base/platform.ts (1)
66-68: 新增配置访问方法实现合理添加的
getConfig()公共方法提供了对平台配置的受控访问,实现简洁且符合封装原则。建议为新增的公共方法添加 JSDoc 注释,以便明确其用途和返回值:
+ /** + * 获取当前平台配置 + * @returns 平台配置对象 + */ public getConfig() { return this.config }packages/taroize/package.json (1)
7-10: 入口指向 dist/src/index.js,需确认包使用方路径期望目前
tsc输出为dist/src/index.js,入口指向深层路径虽然可用,但社区常见做法是构建后扁平到dist/index.js。如果下游脚手架或 bundler 有基于目录结构的假设,深层入口可能导致 tree-shaking 或 alias 处理异常。如无特殊需求,建议修改
rootDir/outDir或在构建后复制文件,使main直接指向dist/index.js,同时提供exports字段明确子路径。示例 diff:- "main": "dist/src/index.js", + "main": "dist/index.js", + "exports": { + ".": "./dist/index.js" + },[建议可选优化]
packages/taro-transformer-wx/package.json (1)
4-5: main 改为 dist/src/index.js 同时移除 CLI 文件,注意 bin 暴露
- 将入口改到深层路径与构建目录一致 ✅
- 但此前仓库曾存在
cli.js并通过bin字段暴露;若同时删除cli.js但未调整bin字段,发布后全局命令可能失效。请检查package.json.bin是否仍指向旧文件。- 同样地,深层入口问题可参考 taroize 的建议。
Also applies to: 15-18
packages/babel-plugin-transform-taroapi/__tests__/__mocks__/h5-definition.json (1)
1-2477: 超大 JSON Mock 建议拆分或脚本化生成
整个 mock 文件近 2.5k 行,随仓库一起版本控制会拖慢 clone/checkout,并且维护成本高。
- 可考虑按照功能域拆分为多个小文件并在测试前合并。
- 或用脚本从源码/官方声明自动生成,减少手工同步错误。
📜 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 (37)
.pnpmfile.cjs(1 hunks)package.json(0 hunks)packages/babel-plugin-transform-taroapi/__tests__/__mocks__/h5-definition.json(1 hunks)packages/babel-plugin-transform-taroapi/__tests__/index.spec.ts(1 hunks)packages/jest-helper/package.json(1 hunks)packages/jest-helper/tsconfig.json(1 hunks)packages/rollup-plugin-copy/index.js(1 hunks)packages/rollup-plugin-copy/package.json(1 hunks)packages/rollup-plugin-copy/tsconfig.json(1 hunks)packages/taro-platform-harmony/package.json(1 hunks)packages/taro-platform-harmony/rollup.config.ts(2 hunks)packages/taro-platform-harmony/tsconfig.json(1 hunks)packages/taro-plugin-mini-ci/.gitignore(0 hunks)packages/taro-plugin-mini-ci/README.md(15 hunks)packages/taro-plugin-mini-ci/index.js(0 hunks)packages/taro-plugin-mini-ci/package.json(1 hunks)packages/taro-plugin-mini-ci/tsconfig.json(1 hunks)packages/taro-runner-utils/.gitignore(0 hunks)packages/taro-runner-utils/package.json(1 hunks)packages/taro-runner-utils/tsconfig.json(1 hunks)packages/taro-service/.gitignore(0 hunks)packages/taro-service/index.js(0 hunks)packages/taro-service/package.json(2 hunks)packages/taro-service/src/platform-plugin-base/platform.ts(1 hunks)packages/taro-service/tsconfig.json(0 hunks)packages/taro-transformer-wx/CHANGELOG.md(0 hunks)packages/taro-transformer-wx/index.js(0 hunks)packages/taro-transformer-wx/jest.config.ts(0 hunks)packages/taro-transformer-wx/package.json(2 hunks)packages/taro-transformer-wx/tsconfig.json(1 hunks)packages/taroize/.gitignore(0 hunks)packages/taroize/index.js(0 hunks)packages/taroize/package.json(1 hunks)packages/taroize/src/index.ts(1 hunks)packages/taroize/tsconfig.json(1 hunks)tests/jest.config.ts(1 hunks)tests/package.json(1 hunks)
💤 Files with no reviewable changes (12)
- packages/taro-transformer-wx/jest.config.ts
- package.json
- packages/taro-plugin-mini-ci/.gitignore
- packages/taro-transformer-wx/index.js
- packages/taro-service/.gitignore
- packages/taro-service/tsconfig.json
- packages/taro-runner-utils/.gitignore
- packages/taroize/.gitignore
- packages/taro-plugin-mini-ci/index.js
- packages/taroize/index.js
- packages/taro-transformer-wx/CHANGELOG.md
- packages/taro-service/index.js
🧰 Additional context used
🧠 Learnings (23)
📓 Common learnings
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taro-runner-utils/tsconfig.json (3)
Learnt from: ianzone
PR: NervJS/taro#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
PR: NervJS/taro#17842
File: packages/taro-components/project.json:4-8
Timestamp: 2025-06-21T21:23:03.650Z
Learning: In Nx 21, project.json targets don't necessarily require explicit "executor" and "options" fields like in earlier versions. A target can be defined with just "outputs" configuration, especially for custom build processes or when using implicit executors.
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
packages/taro-plugin-mini-ci/tsconfig.json (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taro-platform-harmony/rollup.config.ts (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taroize/tsconfig.json (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/rollup-plugin-copy/package.json (2)
Learnt from: ianzone
PR: NervJS/taro#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
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
packages/taro-transformer-wx/tsconfig.json (3)
Learnt from: ianzone
PR: NervJS/taro#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
PR: NervJS/taro#17842
File: packages/taro-components/project.json:4-8
Timestamp: 2025-06-21T21:23:03.650Z
Learning: In Nx 21, project.json targets don't necessarily require explicit "executor" and "options" fields like in earlier versions. A target can be defined with just "outputs" configuration, especially for custom build processes or when using implicit executors.
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
packages/rollup-plugin-copy/tsconfig.json (1)
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
packages/taro-platform-harmony/tsconfig.json (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taroize/src/index.ts (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/jest-helper/package.json (2)
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taro-runner-utils/package.json (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taro-platform-harmony/package.json (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
tests/package.json (2)
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taroize/package.json (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/jest-helper/tsconfig.json (2)
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taro-transformer-wx/package.json (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
.pnpmfile.cjs (2)
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: ianzone
PR: NervJS/taro#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 文件。
tests/jest.config.ts (2)
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taro-plugin-mini-ci/package.json (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taro-service/package.json (1)
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/babel-plugin-transform-taroapi/__tests__/index.spec.ts (2)
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taro-plugin-mini-ci/README.md (2)
Learnt from: ianzone
PR: NervJS/taro#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
PR: NervJS/taro#17842
File: packages/taro-components/project.json:4-8
Timestamp: 2025-06-21T21:23:03.650Z
Learning: In Nx 21, project.json targets don't necessarily require explicit "executor" and "options" fields like in earlier versions. A target can be defined with just "outputs" configuration, especially for custom build processes or when using implicit executors.
🪛 LanguageTool
packages/taro-plugin-mini-ci/README.md
[uncategorized] ~327-~327: 您的意思是“"需要"”吗?
Context: ...,生成方式同上 (privateKeyPath 和 privateKey 之间必须要填写其中一个;3.6.0 版本开始支持) | | ...
(XU7_XU8)
🔇 Additional comments (25)
packages/taro-plugin-mini-ci/tsconfig.json (1)
12-13: 确认已全局移除types/引用
删除declarationDir后,声明文件将输出至dist。请再次搜索并确认:
package.json的types字段、files数组以及任何脚本不再引用types/目录;- CI 流程的清理、发布脚本没有残留
rm -rf types等命令。
避免遗漏造成构建或发布失败。packages/taro-platform-harmony/package.json (1)
29-29: 构建脚本配置更新正确将 rollup 配置文件从
.mts改为.ts并移除--bundleConfigAsCjs标志是合理的简化,与其他配置文件的更改保持一致。packages/taro-platform-harmony/tsconfig.json (1)
11-11: TypeScript 配置更新与其他文件保持一致将 include 数组中的
rollup.config.mts更新为rollup.config.ts与 package.json 中的脚本更改保持一致。packages/taro-platform-harmony/rollup.config.ts (2)
20-20: TypeScript 插件排除配置更新正确将排除模式从
rollup.config.mts更新为rollup.config.ts与文件扩展名的更改保持一致。
84-86: 保持配置一致性在
otherConfig中同样更新排除模式,确保所有 TypeScript 插件配置的一致性。packages/taro-transformer-wx/tsconfig.json (1)
8-8: package.json 输出配置验证通过已验证
packages/taro-transformer-wx/package.json配置:
- main 字段已更新为
"dist/src/index.js"- files 配置包含
"dist"以上均符合预期,无需进一步修改。
packages/taro-runner-utils/package.json (2)
8-8: 类型声明文件路径更新正确将
types字段更新为dist/index.d.ts与构建输出标准化保持一致。
10-10: 发布文件配置简化合理将
files数组简化为仅包含dist目录,与类型声明文件合并到统一输出目录的策略一致。packages/taro-runner-utils/tsconfig.json (1)
8-8: 类型声明配置简化保留
declaration: true的同时移除单独的declarationDir配置,使类型声明文件与编译输出统一生成到dist目录,简化了构建配置。.pnpmfile.cjs (2)
7-8: Jest 依赖版本锁定改进为
@stencil/core包显式锁定jest和jest-cli版本到 27.5.1,解决了该包不自行约束 Jest 版本可能导致的依赖冲突问题。
9-10: 完善 Jest 相关依赖版本管理补充锁定
jest-runner和jest-environment-node版本,确保整个 Jest 测试环境的版本一致性,有助于提高测试的稳定性和可重现性。packages/taro-service/package.json (1)
7-8: 构建输出标准化变更看起来正确将主入口点和类型声明文件路径更新到
dist目录,并简化files数组的配置是合理的。这些变更与整体的构建输出标准化保持一致。Also applies to: 17-17
packages/taro-plugin-mini-ci/package.json (1)
12-13: 构建配置标准化改进将
typings字段重命名为types(更标准的字段名)并将所有路径更新到dist目录是很好的改进。这些变更与整体的包结构标准化保持一致。Also applies to: 15-15
packages/taro-plugin-mini-ci/README.md (1)
3-3: 文档格式化改进这些文档格式化改进提高了可读性和一致性,包括:
- 标准化中文文本中的空格使用
- 统一英文单词和标点符号周围的间距
- 改进代码示例中的注释格式
- 增强配置选项描述的一致性
这些变更不影响插件功能,纯粹是文档质量的提升。
Also applies to: 18-18, 25-25, 33-33, 39-39, 43-43, 57-57, 61-61, 76-76, 81-81, 85-85, 111-111, 113-113, 117-117, 139-139, 143-143, 150-150, 152-152, 173-173, 177-177, 281-281, 289-289, 290-290, 291-291, 292-292, 293-293, 326-326, 327-327, 328-328, 329-329, 366-366, 367-367, 377-377, 397-397, 399-399, 401-401, 403-403, 405-405, 409-409, 411-411, 425-425, 437-437, 483-483, 490-490, 492-492, 494-494, 496-496, 500-500, 516-516, 522-522, 530-530
packages/taroize/tsconfig.json (1)
5-5: 构建输出目录标准化将
outDir从lib更改为dist与整体的包结构标准化保持一致,确保 TypeScript 编译输出与 package.json 中更新的入口点路径匹配。tests/package.json (1)
17-17: 依赖添加正确添加
jest-taro-helper工作空间依赖与其他文件中的重构变更保持一致,支持测试配置中对快照序列化器的引用。packages/rollup-plugin-copy/tsconfig.json (2)
6-6: 输出目录标准化正确将输出目录从
lib改为dist符合此次清理的统一标准。
10-10: 简化包含配置合理移除测试目录排除配置并简化为仅包含
./src,与其他包的配置保持一致。packages/rollup-plugin-copy/index.js (1)
1-1: 入口文件路径更新正确将模块引用路径从
./lib/index.js更新为./dist/index.js,与 tsconfig.json 中的输出目录变更保持一致。packages/jest-helper/package.json (2)
9-9: 文件发布配置更新正确将发布文件从
lib更新为dist目录,与构建输出目录变更保持一致。
14-14: 清理脚本更新正确将清理脚本目标目录从
./lib更新为./dist,与新的构建输出目录匹配。tests/jest.config.ts (1)
12-12: 快照序列化器路径更新正确将快照序列化器路径从
jest-taro-helper/lib/snapshot/serializers.js更新为jest-taro-helper/dist/snapshot/serializers.js,与 jest-helper 包的构建输出目录变更保持同步。packages/jest-helper/tsconfig.json (1)
5-6: 编译产物目录统一到 dist 👍将
outDir改为dist并删除对__tests__目录的排除,与本次仓库范围的目录统一保持一致,且 jest-helper 本身并无测试目录,不会引入意外文件。变更符合预期。Also applies to: 9-9
packages/rollup-plugin-copy/package.json (1)
10-11: 脚本与 files 字段同步到 dist
files与clean均改指向dist,与tsconfig输出一致,避免后续发布缺文件或清理不到位的问题,变更正确。Also applies to: 15-15
packages/babel-plugin-transform-taroapi/__tests__/index.spec.ts (1)
5-6: 导入本地 mock JSON,需确保 tsconfig.resolveJsonModule 已开启
import * as definition from './__mocks__/h5-definition.json'依赖 TypeScriptresolveJsonModule与esModuleInterop。请确认包或根级tsconfig.json中已显式设置这两个编译选项,否则ts-jest在 CI 下可能因无法解析 JSON 导致构建失败。
packages/babel-plugin-transform-taroapi/__tests__/__mocks__/h5-definition.json
Show resolved
Hide resolved
packages/babel-plugin-transform-taroapi/__tests__/__mocks__/h5-definition.json
Show resolved
Hide resolved
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-platform-h5/scripts/post-build.mjs (1)
12-24: 修复格式问题并改善错误信息脚本的核心逻辑正确,但需要修复一些格式问题:
try { // 读取源文件内容 const sourceContent = readFileSync(sourceFileDist, 'utf8') // 写入目标文件 writeFileSync(targetFile, sourceContent, 'utf8') console.log('✅ 成功将definition.json内容覆盖到h5-definition.json') - } catch (error) { - console.error('❌ 脚本执行失败:', error.message) + console.error('❌ 脚本执行失败:', error.message) process.exit(1) } +注意:在构建脚本中使用 console 语句是合理的,尽管 ESLint 有警告。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
packages/taroize/__tests__/__snapshots__/index.test.ts.snapis excluded by!**/*.snappackages/taroize/__tests__/__snapshots__/script.test.ts.snapis excluded by!**/*.snappackages/taroize/__tests__/__snapshots__/template.test.ts.snapis excluded by!**/*.snappackages/taroize/__tests__/__snapshots__/utils.test.ts.snapis excluded by!**/*.snappackages/taroize/__tests__/__snapshots__/wxml.test.ts.snapis excluded by!**/*.snappnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
packages/taro-platform-h5/package.json(1 hunks)packages/taro-platform-h5/scripts/post-build.mjs(1 hunks)packages/taroize/__tests__/event.test.ts(3 hunks)packages/taroize/__tests__/index.test.ts(2 hunks)packages/taroize/__tests__/script.test.ts(11 hunks)packages/taroize/__tests__/template.test.ts(15 hunks)packages/taroize/__tests__/util.ts(2 hunks)packages/taroize/__tests__/utils.test.ts(5 hunks)packages/taroize/__tests__/wxml.test.ts(35 hunks)
✅ Files skipped from review due to trivial changes (7)
- packages/taro-platform-h5/package.json
- packages/taroize/tests/util.ts
- packages/taroize/tests/utils.test.ts
- packages/taroize/tests/script.test.ts
- packages/taroize/tests/template.test.ts
- packages/taroize/tests/wxml.test.ts
- packages/taroize/tests/event.test.ts
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taroize/__tests__/index.test.ts (2)
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taro-platform-h5/scripts/post-build.mjs (2)
Learnt from: ianzone
PR: NervJS/taro#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
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
🪛 ESLint
packages/taro-platform-h5/scripts/post-build.mjs
[error] 1-3: Run autofix to sort these imports!
(simple-import-sort/imports)
[error] 1-1: 'existsSync' is defined but never used.
(@typescript-eslint/no-unused-vars)
[error] 19-19: Unexpected console statement.
(no-console)
[error] 19-21: Block must not be padded by blank lines.
(padded-blocks)
[error] 24-24: Newline required at end of file but not found.
(eol-last)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- 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 (4)
packages/taroize/__tests__/index.test.ts (2)
36-37: 格式化改进很好在中文字符和关键词周围添加空格提高了代码可读性,与其他测试文件的格式化保持一致。
1-1: 确认导入方式一致
- packages/taroize/src/index.ts 中已将
parse声明为export default function parse- 测试文件 packages/taroize/tests/index.test.ts 以
import parse from '../src'引入默认导出,符合源码导出方式- 整个仓库中未发现其他使用命名导入
parse的情况第 36–37 行的中文空格优化仅为可读性调整,无需改动。
packages/taro-platform-h5/scripts/post-build.mjs (2)
5-6: ES 模块兼容性处理正确这是在 ES 模块中获取
__dirname的标准做法,实现正确。
8-10: 文件路径定义正确源文件和目标文件的路径定义准确,符合将构建输出复制到测试 mock 文件的需求。
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 (2)
packages/taro-platform-h5/scripts/post-build.mjs (2)
12-17: 读取源文件前缺少存在性检查,运行时易崩溃当
dist/definition.json尚未生成或路径错误时,readFileSync会直接抛错导致脚本异常退出。建议先判断文件是否存在并给出友好提示。- // 读取源文件内容 - const sourceContent = readFileSync(sourceFileDist, 'utf8') + // 检查源文件是否存在 + if (!existsSync(sourceFileDist)) { + throw new Error(`源文件不存在: ${sourceFileDist}`) + } + // 读取源文件内容 + const sourceContent = readFileSync(sourceFileDist, 'utf8')
1-3: 按 ESLint 要求调整导入顺序,并补充existsSync依赖
simple-import-sort报错说明当前导入顺序不符合规范,同时缺少文件存在性检查所需的existsSync。建议一起修复:
- 先按字母顺序排列同一行中的导入成员;
- 引入
existsSync以便后续文件读写前做安全检查。-import { readFileSync, writeFileSync } from 'fs' -import { resolve, dirname } from 'path' -import { fileURLToPath } from 'url' +import { existsSync, readFileSync, writeFileSync } from 'fs' +import { dirname, resolve } from 'path' +import { fileURLToPath } from 'url'
🧹 Nitpick comments (2)
packages/taro-platform-h5/scripts/post-build.mjs (2)
19-22:console调用违反仓库 ESLint 规则
no-console已提示不可直接使用console.log / console.error。如日志信息确属必要,可:
- 使用
process.stderr.write/process.stdout.write;- 或在文件顶部添加
/* eslint-disable no-console */注释,并附上理由。请根据团队规范做取舍。
24-24: 文件末尾缺失换行符缺少 EOF 换行会触发
eol-last规则,影响 diff 可读性。补上一行空行即可。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/taro-platform-h5/scripts/post-build.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: ianzone
PR: NervJS/taro#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 文件。
packages/taro-platform-h5/scripts/post-build.mjs (5)
Learnt from: ianzone
PR: NervJS/taro#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: Single-Dancer
PR: NervJS/taro#17653
File: packages/taro-components-advanced/src/components/water-flow/node.ts:83-95
Timestamp: 2025-05-06T06:55:44.077Z
Learning: 在 Taro 的 getRectSizeSync 函数中,如果找不到指定的节点,函数会一直处于 pending 状态而不是抛出错误。在这种情况下,使用 try/catch 处理不够充分,需要添加超时处理如 Promise.race 来避免无限等待。
Learnt from: ianzone
PR: NervJS/taro#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 目录。不要假设包中存在测试目录结构。
Learnt from: Single-Dancer
PR: NervJS/taro#17653
File: packages/taro-components-advanced/src/components/water-flow/node.ts:83-95
Timestamp: 2025-05-06T06:55:44.077Z
Learning: 在 Taro 的 water-flow 组件中,getRectSizeSync 函数如果找不到指定的节点,会一直处于 pending 状态而不是抛出错误。在这种情况下,应该使用 Promise.race 添加超时机制,而不是仅依赖 try/catch 来处理错误。
Learnt from: Single-Dancer
PR: NervJS/taro#17653
File: packages/taro-components-advanced/src/components/water-flow/node.ts:83-95
Timestamp: 2025-05-06T06:55:44.077Z
Learning: 在 Taro 的 water-flow 组件中,getRectSizeSync 函数如果找不到指定的节点并且重试次数用尽,会一直处于 pending 状态而不是抛出错误,因为它在 retryTimes <= 0 时直接返回而不 resolve 或 reject Promise。应该使用 Promise.race 添加超时机制来解决这个问题。
🪛 ESLint
packages/taro-platform-h5/scripts/post-build.mjs
[error] 1-3: Run autofix to sort these imports!
(simple-import-sort/imports)
[error] 19-19: Unexpected console statement.
(no-console)
[error] 19-21: Block must not be padded by blank lines.
(padded-blocks)
[error] 24-24: Newline required at end of file but not found.
(eol-last)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- 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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17910 +/- ##
==========================================
- Coverage 55.90% 54.98% -0.92%
==========================================
Files 417 417
Lines 21693 21693
Branches 5376 5369 -7
==========================================
- Hits 12127 11928 -199
- Misses 7935 8082 +147
- Partials 1631 1683 +52
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@yoyo837 这个合了就去解决 taro/components 相关的问题,然后就可以添加 nx 了 |
|
看下 |
我说的问题是指与 taro-components 相关的循环依赖问题 |


这个 PR 做了什么? (简要描述所做更改)
#17842 中的杂项
这个 PR 是什么类型? (至少选择一个)
Summary by CodeRabbit
新功能
TaroPlatform类新增getConfig()公共方法,用于获取当前平台配置。修复与优化
dist,并调整主入口、类型声明等相关路径,简化包发布内容。.gitignore,优化项目结构。文档
@tarojs/plugin-mini-ci的 README 文档格式与表述,更加规范易读。其他