Skip to content
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: show unadapted components for HarmonyOS in Mini Programs and H5 #2999

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

oasis-cloud
Copy link
Collaborator

@oasis-cloud oasis-cloud commented Feb 18, 2025

Summary by CodeRabbit

  • Chores
    • 优化了开发和构建流程,简化了命令管理,提高了整体执行效率和稳定性。
  • New Features
    • 新增了环境变量控制逻辑,在特定环境下允许预览尚未完全适配的组件,提升了预览体验。
    • 更新了文档,增强了对 Taro 环境的说明,提供了新钩子功能的额外上下文。

Copy link

coderabbitai bot commented Feb 18, 2025

Warning

Rate limit exceeded

@oasis-cloud has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between cdb7281 and 3bccbf4.

📒 Files selected for processing (1)
  • README_ZH.md (2 hunks)

Walkthrough

此次修改主要针对 @nutui/nutui-react-taro 包内的脚本配置和更新入口逻辑进行了调整。在 package.json 中,删除了部分冗余脚本,并新增或修改了多个开发及构建脚本,通过预设环境变量(如 SKIPDD、JD)来控制命令执行。在 scripts/harmony/update-taro-entry.js 文件中,新增了对 SKIPDD 环境变量的判断,从而影响组件的导出逻辑,同时添加了详细注释以便开发者理解该逻辑。

Changes

文件 修改摘要
package.json 删除了 add:taro:config 脚本,新增 predev:taroprebuild:taro:site 脚本;调整了 dev:*build:* 系列脚本,通过设置环境变量(SKIPDD、JD)来控制执行顺序。
scripts/harmony/update-taro-entry.js 增加 SKIPDD 环境变量判断逻辑,修改了组件导出条件,并添加了相关注释说明。

Sequence Diagram(s)

sequenceDiagram
    participant U as 用户
    participant S as 脚本执行器
    participant P as package.json 脚本
    participant E as update-taro-entry.js

    U->>S: 触发 dev 或 build 命令
    S->>P: 执行 predev/prebuild 脚本设置环境变量(SKIPDD=1 或 JD=1)
    S->>P: 调用 update:taro:entry 命令
    P->>E: 运行入口更新逻辑
    E->>E: 检查 SKIPDD 环境变量与组件适配状态
    E->>S: 返回组件导出结果
Loading

Possibly related PRs

Suggested reviewers

  • irisSong
  • Alex-huxiyang

Poem

我是一只机灵小兔,
跳跃在代码的花园里,
环境变量如春风轻拂,
命令纷飞整齐划一,
脚本流转成诗篇,
程序世界多彩缤纷!
🐰✨


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added action:review This PR needs more reviews (less than 2 approvals) 3.x Target branch 3.x labels Feb 18, 2025
@oasis-cloud oasis-cloud requested a review from irisSong February 18, 2025 10:03
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.79%. Comparing base (7ab99e4) to head (3bccbf4).
Report is 2 commits behind head on feat_v3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           feat_v3.x    #2999   +/-   ##
==========================================
  Coverage      85.79%   85.79%           
==========================================
  Files            281      281           
  Lines          18527    18527           
  Branches        2810     2810           
==========================================
  Hits           15896    15896           
  Misses          2626     2626           
  Partials           5        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oasis-cloud oasis-cloud changed the title chore: 通过 pre 命令在 h5 和小程序预览或构建的时候,去掉鸿蒙适配的限制,从而展示出未适配鸿蒙的组件 chore: show unadapted components for HarmonyOS in Mini Programs and H5 Feb 18, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
scripts/harmony/update-taro-entry.js (1)

23-23: 建议优化条件判断的可读性

当前的条件判断使用了双重否定,可以重构为更易读的形式。

建议修改为:

-if (!dd && !process.env.SKIPDD) return // 未适配不导出
+if (dd || process.env.SKIPDD) {
+  // 继续执行导出逻辑
+} else {
+  return // 未适配不导出
+}
package.json (1)

67-67: 建议统一环境变量的设置方式

为了保持一致性,建议将 JD=1 的设置也移动到预处理脚本中。

建议修改为:

-"dev:taro:jmapp": "JD=1 pnpm --dir ./packages/nutui-taro-demo dev:jmapp",
+"predev:taro:jmapp": "SKIPDD=1 JD=1 pnpm run update:taro:entry",
+"dev:taro:jmapp": "pnpm --dir ./packages/nutui-taro-demo dev:jmapp",
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7ab99e4 and 5eb8024.

📒 Files selected for processing (2)
  • package.json (1 hunks)
  • scripts/harmony/update-taro-entry.js (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (3)
scripts/harmony/update-taro-entry.js (1)

21-23: 代码注释清晰地解释了功能目的

注释很好地说明了这个改动的目的和具体场景,有助于其他开发者理解代码的意图。

package.json (2)

60-61: 预处理脚本的添加确保了一致的组件导出行为

通过添加 pre 脚本并设置 SKIPDD=1,在开发环境中统一了组件的导出行为,这是一个很好的实践。

Also applies to: 63-65


73-75: 构建脚本的修改保持了与开发环境的一致性

构建脚本的修改与开发环境保持了相同的行为,这种一致性有助于避免环境差异导致的问题。

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
README_ZH.md (1)

74-77: 新增 Taro 环境说明段落
在本次修改中,新增了“### 本地运行 Taro 环境”标题以及后续的说明文字,详细说明了在 Taro 环境下通过 pnpm pre 钩子展示未适配鸿蒙组件的目的和方法。这能帮助开发者更好理解预览时的组件显示逻辑。建议确认该说明与实际脚本逻辑保持一致,同时可在后续文档中补充启用/关闭钩子时可能的行为差异。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5eb8024 and cdb7281.

📒 Files selected for processing (1)
  • README_ZH.md (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (1)
README_ZH.md (1)

101-101: 更新 JDTaro 预览标题
对“本地运行 JDTaro 相关的预览”标题进行了格式调整,使其在整体排版中与其它环境说明部分保持一致。该修改属于格式和可读性提升,建议确认下方说明内容与标题对应无误。

@irisSong irisSong merged commit a5014bf into jdf2e:feat_v3.x Feb 19, 2025
8 checks passed
oasis-cloud added a commit to oasis-cloud/nutui-react that referenced this pull request Feb 20, 2025
jdf2e#2999)

* chore: 通过 pre 命令在 h5 和小程序预览或构建的时候,去掉鸿蒙适配的限制,从而展示出未适配鸿蒙的组件

* docs: update docs

* docs: update docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Target branch 3.x action:review This PR needs more reviews (less than 2 approvals) size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants