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

feat(replace icon): 替换jmapp icon #2672

Merged
merged 24 commits into from
Oct 29, 2024
Merged

Conversation

jqroom
Copy link
Contributor

@jqroom jqroom commented Oct 29, 2024

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • fork仓库代码是否为最新避免文件冲突
  • Files changed 没有 package.json lock 等无关文件

Summary by CodeRabbit

  • 新功能

    • nutui-taro-demo 包添加了新的 .npmrc 配置文件,支持多种注册表设置。
    • @nutui/nutui-taro-demo 项目中添加了 @nutui/replace-icons 依赖。
  • 依赖更新

    • @nutui/nutui-react-taro 项目中添加了 @nutui/jdesign-icons-react-taro 依赖。
    • 更新了 prettier-markdown-table 依赖的管理方式。
  • 配置修改

    • Babel 配置中添加了条件加载 replaceIcons 插件的功能。

Copy link

coderabbitai bot commented Oct 29, 2024

Warning

Rate limit exceeded

@jqroom has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 37 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

Files that changed from the base of the PR and between 1a02395 and c069154.

Walkthrough

该拉取请求对多个配置文件进行了修改,主要是.npmrcpackage.json文件。.npmrc文件更新了多个作用域的注册表设置,指定了不同的注册表URL。package.json文件添加了新的依赖项,并对现有依赖项进行了重新组织。整体结构保持不变,但引入了新的依赖和配置。

Changes

文件路径 更改摘要
.npmrc 更新多个作用域的注册表设置,指定了不同的注册表URL,包括@jdreact@jdtaro等。
package.json 添加了依赖项@nutui/jdesign-icons-react-taro,移除并重新添加了prettier-markdown-table
packages/nutui-taro-demo/.npmrc 创建新的.npmrc文件,配置多个作用域的注册表URL。
packages/nutui-taro-demo/babel.config.js 添加@nutui/replace-icons模块,更新Babel配置以条件性地包含replaceIcons插件。
packages/nutui-taro-demo/package.json 添加了依赖项@nutui/replace-icons,版本为1.0.0

Possibly related PRs

Suggested labels

size/M

Suggested reviewers

  • oasis-cloud

兔子在草地上跳跃,
新配置如花绽放,
注册表更新真美好,
依赖项齐齐来,
代码世界更辉煌! 🐇✨


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 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.

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: 4

🧹 Outside diff range and nitpick comments (3)
.npmrc (2)

1-2: 注意:请避免使用注释掉的配置

建议删除注释掉的registry配置,以避免混淆。保留多个registry配置可能会导致维护困难,建议只保留正在使用的配置。

-# registry=http://registry.m.jd.com/
registry=https://registry.npmjs.org/

Line range hint 13-14: 建议:删除多余的空行

文件末尾存在多个空行,建议只保留一个空行。

engine-strict=true
strict-peer-dependencies=false
-
-
+
packages/nutui-taro-demo/babel.config.js (1)

3-4: 建议为 projectID 添加默认值

为了避免环境变量未定义时可能出现的问题,建议添加一个默认值:

-const projectID = process.env.VITE_APP_PROJECT_ID
+const projectID = process.env.VITE_APP_PROJECT_ID || ''
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2f71fda and 1a02395.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • .npmrc (1 hunks)
  • package.json (2 hunks)
  • packages/nutui-taro-demo/.npmrc (1 hunks)
  • packages/nutui-taro-demo/babel.config.js (2 hunks)
  • packages/nutui-taro-demo/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/nutui-taro-demo/.npmrc
🔇 Additional comments (2)
.npmrc (1)

Line range hint 1-14: 验证:确认registry可访问性

请确认所有配置的registry都是可访问的,特别是在CI/CD环境中。建议添加相关文档说明这些registry的用途和访问要求。

packages/nutui-taro-demo/package.json (1)

48-48: 新增依赖包审查

依赖包的添加符合PR的目标。建议:

  1. 确认是否已在不同环境(weapp、h5等)下测试过图标替换功能
  2. 验证与现有的@nutui相关依赖的兼容性
✅ Verification successful

新增的 @nutui/replace-icons 版本与现有依赖兼容

经过验证,@nutui/[email protected] 与项目中其他 @nutui 相关依赖的版本兼容:

  • @nutui/icons-react 和 @nutui/icons-react-taro 均为 ^1.0.5
  • @nutui/touch-emulator 也使用了相同的主版本 ^1.0.0

此版本选择合理且安全。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查其他@nutui包的版本兼容性
echo "检查其他@nutui包的版本:"
rg '"@nutui/[^"]+": "[^"]+"' -g 'package.json'

Length of output: 1252

.npmrc Outdated
Comment on lines 4 to 10
@jdreact:registry=http://registry.m.jd.com/
@jdtaro:registry=http://registry.m.jd.com/
@test:registry=http://registry.m.jd.com/
@ohos:registry=https://repo.harmonyos.com/npm/
@jd:registry=http://registry.m.jd.com/
@dongdesign:registry=http://registry.m.jd.com/
@nutui:registry=http://registry.m.jd.com/
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

安全警告:避免使用不安全的HTTP协议

当前配置中使用了不安全的HTTP协议来访问npm registry。这可能会使包下载过程容易受到中间人攻击。建议将所有registry URL更改为HTTPS。

建议修改如下:

-@jdreact:registry=http://registry.m.jd.com/
-@jdtaro:registry=http://registry.m.jd.com/
-@test:registry=http://registry.m.jd.com/
+@jdreact:registry=https://registry.m.jd.com/
+@jdtaro:registry=https://registry.m.jd.com/
+@test:registry=https://registry.m.jd.com/
@ohos:registry=https://repo.harmonyos.com/npm/
-@jd:registry=http://registry.m.jd.com/
-@dongdesign:registry=http://registry.m.jd.com/
-@nutui:registry=http://registry.m.jd.com/
+@jd:registry=https://registry.m.jd.com/
+@dongdesign:registry=https://registry.m.jd.com/
+@nutui:registry=https://registry.m.jd.com/
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@jdreact:registry=http://registry.m.jd.com/
@jdtaro:registry=http://registry.m.jd.com/
@test:registry=http://registry.m.jd.com/
@ohos:registry=https://repo.harmonyos.com/npm/
@jd:registry=http://registry.m.jd.com/
@dongdesign:registry=http://registry.m.jd.com/
@nutui:registry=http://registry.m.jd.com/
@jdreact:registry=https://registry.m.jd.com/
@jdtaro:registry=https://registry.m.jd.com/
@test:registry=https://registry.m.jd.com/
@ohos:registry=https://repo.harmonyos.com/npm/
@jd:registry=https://registry.m.jd.com/
@dongdesign:registry=https://registry.m.jd.com/
@nutui:registry=https://registry.m.jd.com/

Comment on lines +18 to +24
projectID === 'jmapp' && [
replaceIcons({
sourceLibrary: ['@nutui/icons-react-taro', '@nutui/icons-react'],
targetLibrary: '@nutui/jdesign-icons-react-taro',
}),
],
].filter(Boolean),
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

缺少必要的图标依赖项,需要添加相关依赖

检查结果显示,当前项目中缺少以下必要的依赖项:

  • @nutui/icons-react-taro
  • @nutui/icons-react
  • @nutui/jdesign-icons-react-taro

虽然 @nutui/replace-icons 已经安装(版本1.0.0),但是其他用于图标替换的依赖项都未安装。这些依赖项对于图标替换功能的正常运行是必需的。

建议在 package.json 中添加这些缺失的依赖项。

🔗 Analysis chain

配置结构合理,建议验证依赖项

配置结构清晰,使用 filter(Boolean) 处理条件插件的方式很好。

请运行以下脚本验证相关依赖是否正确安装:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 验证所需依赖是否在 package.json 中定义

# 检查替换图标相关的依赖
jq -r '.dependencies | select(
  has("@nutui/replace-icons") and
  has("@nutui/icons-react-taro") and
  has("@nutui/icons-react") and
  has("@nutui/jdesign-icons-react-taro")
)' packages/nutui-taro-demo/package.json

Length of output: 217


Script:

#!/bin/bash
# 让我们分别检查每个依赖项
echo "检查 package.json 中的依赖项:"
jq '.dependencies | {
  "@nutui/replace-icons": .["@nutui/replace-icons"],
  "@nutui/icons-react-taro": .["@nutui/icons-react-taro"],
  "@nutui/icons-react": .["@nutui/icons-react"],
  "@nutui/jdesign-icons-react-taro": .["@nutui/jdesign-icons-react-taro"]
}' packages/nutui-taro-demo/package.json

echo -e "\n检查 devDependencies 中的依赖项:"
jq '.devDependencies | {
  "@nutui/replace-icons": .["@nutui/replace-icons"],
  "@nutui/icons-react-taro": .["@nutui/icons-react-taro"],
  "@nutui/icons-react": .["@nutui/icons-react"],
  "@nutui/jdesign-icons-react-taro": .["@nutui/jdesign-icons-react-taro"]
}' packages/nutui-taro-demo/package.json

# 检查是否有相关的导入语句
echo -e "\n检查相关导入语句:"
rg -l "@nutui/(replace-icons|icons-react-taro|icons-react|jdesign-icons-react-taro)"

Length of output: 13533

@@ -184,6 +184,7 @@
"postcss-rtlcss": "^5.1.0",
"postcss-scss": "^4.0.9",
"prettier": "^3.2.5",
"prettier-markdown-table": "^1.0.2",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

建议:将 prettier-markdown-table 移回 devDependencies

prettier-markdown-table 是一个用于格式化 Markdown 表格的开发工具,不应该放在 dependencies 中。这个包只在开发过程中使用,不会在生产环境中被使用。

建议按照以下方式修改:

{
  "dependencies": {
-   "prettier-markdown-table": "^1.0.2"
  },
  "devDependencies": {
+   "prettier-markdown-table": "^1.0.2"
  }
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"prettier-markdown-table": "^1.0.2",

@@ -97,6 +97,7 @@
"@babel/runtime": "^7.23.9",
"@nutui/icons-react": "^1.0.5",
"@nutui/icons-react-taro": "^1.0.5",
"@nutui/jdesign-icons-react-taro": "1.0.6-beta.2",
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

建议谨慎评估依赖版本选择

从 package.json 中可以看到项目已经在使用 @nutui/icons-react@nutui/icons-react-taro 的稳定版本(1.0.5)。新添加的 @nutui/[email protected] 是测试版本,建议:

  • 考虑继续使用现有的稳定版本图标库
  • 或等待 @nutui/jdesign-icons-react-taro 发布正式版本后再引入
  • 如果必须使用测试版,请确保进行充分的兼容性测试
🔗 Analysis chain

注意:使用测试版依赖可能存在风险

新添加的依赖 @nutui/jdesign-icons-react-taro 当前使用的是测试版本 (1.0.6-beta.2)。在生产环境中使用测试版本可能会带来不稳定性。建议:

  • 等待正式版本发布后再升级
  • 或者在使用前进行充分的测试验证
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查是否有正式版本可用
npm view @nutui/jdesign-icons-react-taro versions

Length of output: 700


Script:

#!/bin/bash
# Check if the package is used in the codebase and how it's used
rg -l "@nutui/jdesign-icons-react-taro" --type js --type jsx --type ts --type tsx

# Check if there are any other icon-related packages in package.json
rg "\"@.*icon.*\":" package.json

Length of output: 274

@xiaoyatong xiaoyatong merged commit 61f6431 into jdf2e:next Oct 29, 2024
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants