Skip to content

Conversation

oasis-cloud
Copy link
Collaborator

@oasis-cloud oasis-cloud commented Mar 13, 2025

canvas 同层渲染,需要根据京东小程序文档进行配置。

Summary by CodeRabbit

  • 新功能
    • 引入了混合渲染模式,提升应用组件的渲染表现。
    • 扩展了 Lottie 动画在京东小程序环境下的支持,提升跨平台兼容性。
  • 文档
    • 更新了 Lottie 组件说明,新增了关于京东小程序预览的提示,建议使用真机进行体验。
  • 维护
    • 更新了 Lottie 动画相关依赖,移除了旧版本包,确保库版本一致性。

Copy link

coderabbitai bot commented Mar 13, 2025

Walkthrough

本次 PR 对多个文件进行修改,主要涉及 Lottie 相关依赖与配置的更新。在两个 package.json 文件中,将旧的 "lottie-miniprogram": "^1.0.12" 替换为新的 "@nutui/lottie-miniprogram": "^1.0.1"。此外,更新了 Lottie 组件的导入路径、扩展了环境判断条件(增加 'jd' 环境),并在部分配置文件中新增了 renderingMode: 'mixed' 属性,同时为 JD 小程序预览增加了文档说明。

Changes

File(s) Change Summary
package.json
packages/nutui-taro-demo/package.json
替换 Lottie 依赖:新增 "@nutui/lottie-miniprogram": "^1.0.1",移除 "lottie-miniprogram": "^1.0.12"
scripts/harmony/update-taro-entry.js
scripts/taro/generate-taro-route.js
为配置对象添加 renderingMode: 'mixed' 属性,并调整了注释和格式。
src/packages/lottie/index.taro.ts 扩展环境检测条件(同时支持 'weapp''jd'),并更新 Lottie 实现文件的引用名称。
src/packages/lottie/doc.taro.md 新增 JD 小程序预览说明提示,告知用户需使用真机预览。
src/packages/lottie/index.ts 修改 Lottie 组件的引入路径,从 ./web 修改为 ./lottie
src/packages/lottie/lottiemp.taro.tsx 更新 lottie 库的导入来源,从 lottie-miniprogram 改为 @nutui/lottie-miniprogram

Sequence Diagram(s)

sequenceDiagram
    participant App as 应用
    participant Config as 配置生成器
    participant Env as 环境检测
    participant Lottie as Lottie引擎

    App->>Config: 加载配置(包含 renderingMode: 'mixed')
    Config-->>App: 返回配置对象
    App->>Env: 获取 TARO_ENV 值
    alt 环境为 'weapp' 或 'jd'
      Env-->>App: 返回 'weapp'/'jd'
      App->>Lottie: 加载 Lottiemp 实现(新导入路径)
    else 环境为 'h5'
      Env-->>App: 返回 'h5'
      App->>Lottie: 加载 LottieWeb 实现(更新后的导入)
    end
Loading

Possibly related PRs

Suggested reviewers

  • xiaoyatong
  • irisSong

Poem

我是一只欢快的小兔子,跳跃在代码的田野上,
新依赖如同嫩绿的萝卜,令人期待又芳香。
旧模块悄然谢幕,迎来全新名字的曙光,
配置中增添的混合模式,仿佛阳光洒满原野。
代码之路漫漫前行,我在此处留下快乐的印记!
🐰💻🌟


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a493929 and 5044fd9.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • package.json (1 hunks)
  • src/packages/lottie/doc.taro.md (1 hunks)
  • src/packages/lottie/index.taro.ts (2 hunks)
  • src/packages/lottie/index.ts (1 hunks)
  • src/packages/lottie/lottiemp.taro.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • src/packages/lottie/doc.taro.md
  • src/packages/lottie/lottiemp.taro.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/packages/lottie/index.taro.ts
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (1)
src/packages/lottie/index.ts (1)

1-1: 导入路径变更正确实现了对京东小程序的支持

将导入路径从 './web' 更改为 './lottie' 是支持京东小程序的必要变更。这个变更与 PR 的目标一致,使 Lottie 组件能够跨平台工作,特别是在京东小程序环境中。此更改配合 package.json 中依赖的变更(从 lottie-miniprogram@nutui/lottie-miniprogram)共同支持了京东小程序环境。

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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 Mar 13, 2025
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.95%. Comparing base (384bca0) to head (5044fd9).
Report is 6 commits behind head on feat_v3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           feat_v3.x    #3080   +/-   ##
==========================================
  Coverage      86.95%   86.95%           
==========================================
  Files            280      280           
  Lines          18456    18456           
  Branches        2785     2785           
==========================================
  Hits           16049    16049           
  Misses          2402     2402           
  Partials           5        5           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@irisSong irisSong left a comment

Choose a reason for hiding this comment

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

import { miniprogram } from '@/utils/platform-taro' 是不是可以用这个判断

// @ts-ignore
implementation = LottieWeb
} else if (process.env.TARO_ENV === 'weapp') {
} else if (process.env.TARO_ENV === 'weapp' || process.env.TARO_ENV === 'jd') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

import { miniprogram } from '@/utils/platform-taro' 是不是可以直接用这个判断

Copy link
Collaborator

@xiaoyatong xiaoyatong left a comment

Choose a reason for hiding this comment

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

1、appconfig 中 目前没有 renderingmode 这个字段,出现了类型报错;
2、目录结构中,命名可改为 与其他组件一致的形式,
如:lottie.tsx
lottie.taro.tsx
lottie.taro.h5.tsx
3、目前jd ide 无法展示,可在文档中稍作说明。

@oasis-cloud
Copy link
Collaborator Author

miniprogram

import { miniprogram } from '@/utils/platform-taro' 是不是可以用这个判断

这里不能改,这里要通过 process 的环境变量处理分支编译,去掉无用的环境

@oasis-cloud
Copy link
Collaborator Author

1、appconfig 中 目前没有 renderingmode 这个字段,出现了类型报错; 2、目录结构中,命名可改为 与其他组件一致的形式, 如:lottie.tsx lottie.taro.tsx lottie.taro.h5.tsx 3、目前jd ide 无法展示,可在文档中稍作说明。

2、3 fixed;1 属于 taro 范围

@irisSong irisSong merged commit 2fee43c into jdf2e:feat_v3.x Mar 27, 2025
8 checks passed
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.

3 participants