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

fix: 组件库基于 jdTaro 的改造&&所有端demo合成一个 #2476

Merged
merged 36 commits into from
Jul 25, 2024

Conversation

irisSong
Copy link
Collaborator

@irisSong irisSong commented Jul 23, 2024

🤔 这个变动的性质是?

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

🔗 相关 Issue

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • 新功能

    • 更新了 ESLint 配置,以纳入新的包目录。
    • 增强了 Taro 框架相关的构建和开发脚本,确保在启动开发服务器之前更新 Taro 入口点。
    • 新增了用于克隆 JDHarmony 仓库的自动化脚本,提高了工作流效率。
    • 改进了环境特定的配置逻辑,增强了灵活性和可维护性。
    • 优化了 Taro 路由生成逻辑,以支持动态子包页面。
  • 修复

    • 修正了开发环境中的缓存策略配置。
  • 文档

    • 更新了项目的依赖项和版本信息,确保兼容性。

Copy link

coderabbitai bot commented Jul 23, 2024

Walkthrough

此次更改涉及多个文件的修改,主要集中在 ESLint 忽略规则、构建脚本、配置管理及新增的 React 组件。这些更改旨在提升项目代码的质量和维护性,同时增强 Taro 框架的兼容性,反映出项目结构的重组与功能的扩展。

Changes

文件路径 更改摘要
.eslintignore 移除 packages/nutui-taro-demo-rn/**/*,新增 packages/nutui-jdharmony/**/* 至忽略列表。
gulpfile.js 更新 targetBaseUrl 路径,从 packages/nutui-taro-demo-rn 改为 packages/nutui-taro-demo
package.json 增加多个 Taro 相关命令,新增 "update:taro:entry" 脚本以更新 Taro 入口点,同时更新多个依赖。
packages/nutui-taro-demo/.gitignore 移除旧目录,新增配置和库管理相关条目,反映项目重构。
packages/nutui-taro-demo/config/index.js 替换 @test/inject-platform-styles@dongdesign/inject-jd-platform-styles,新增 jdharmony 环境的配置。
packages/nutui-taro-demo/src/pages/index/index.scss 重构 CSS 样式,采用 BEM 方法,增强可读性与维护性。
packages/nutui-taro-demo/src/pages/index/index.tsx 更新 Index 组件以使用 Taro 的 UI 组件,改进结构,增强代码可读性。
scripts/harmony/clone-jdharmony.js 新增脚本用于克隆 JDHarmony 仓库,并进行目录管理,提升工作效率。
scripts/taro/generate-taro-pages.js 修改组件导出逻辑,确保仅兼容版本的组件被处理,增强兼容性。
scripts/taro/generate-taro-route.js 更新配置对象,新增 components 属性以支持动态路由配置,增强灵活性。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant BuildSystem
    participant ESLint

    User->>App: 触发构建请求
    App->>BuildSystem: 更新配置和脚本
    BuildSystem->>ESLint: 处理文件的 ESLint 忽略规则
    ESLint-->>BuildSystem: 文件处理完成
    BuildSystem-->>User: 构建完成
Loading

🐇
在草地上跳跃的新变化,
代码如花朵般绽放,
ES风格与Taro共舞,
脚本更新迎春光,
小兔子欢笑声声响! 🌷✨


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 820286a and 5a8ba69.

Files selected for processing (2)
  • scripts/harmony/clone-jdharmony.js (1 hunks)
  • scripts/taro/generate-taro-route.js (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • scripts/harmony/clone-jdharmony.js
Additional comments not posted (2)
scripts/taro/generate-taro-route.js (2)

9-9: 使用 const 代替 let 声明 configRef 是一个很好的改进。

这样可以确保 configRef 不会被重新赋值,提高了代码的清晰度和不可变性。


45-47: defineAppConfig 函数中添加 components 属性是一个很好的改进。

这个改动通过将硬编码的页面路径与 subPackages 中的页面组合在一起,动态构建了一个数组,从而增强了应用程序的灵活性和路由能力。

请确保动态数组构建的正确性。

Verification successful

defineAppConfig 函数中添加 components 属性是一个很好的改进。

这个改动通过将硬编码的页面路径与 subPackages 中的页面组合在一起,动态构建了一个数组,从而增强了应用程序的灵活性和路由能力。

  • scripts/rn/update-taro-entry.jsscripts/taro/generate-taro-route.js 中的 components 属性的动态数组构建是正确的。
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the dynamic array construction in the `components` property.

# Test: Search for the `defineAppConfig` function usage. Expect: Correct construction of the `components` array.
rg --type javascript -A 5 $'defineAppConfig'

Length of output: 78


Script:

#!/bin/bash
# Description: Verify the correctness of the dynamic array construction in the `components` property.

# Test: Search for the `defineAppConfig` function usage. Expect: Correct construction of the `components` array.
rg --type js -A 5 $'defineAppConfig'

Length of output: 783


Script:

#!/bin/bash
# Description: Verify the correctness of the dynamic array construction in the `components` property.

# Test: Search for the `components` property within the `defineAppConfig` function. Expect: Correct construction of the `components` array.
rg --type js -A 5 $'components:'

Length of output: 802


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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@irisSong irisSong changed the title fix: 所有端demo合成一个 fix: 组件库基于 jdTaro 的改造&&所有端demo合成一个 Jul 23, 2024
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: 43

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

Outside diff range, codebase verification and nitpick comments (1)
packages/nutui-taro-demo/src/app.ts (1)

10-10: 移除注释的console.log语句

如果不再需要调试信息,建议移除注释的console.log语句。

- // console.log(NutUI)
+ // Remove this line if debugging is no longer needed.

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment

当前代码中使用了一个不必要的Fragment。建议直接返回空元素。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

移除不必要的Fragment

当前代码中使用的Fragment是多余的,可以直接返回空元素。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment

如果Fragment只包含一个子元素,或者它是HTML元素的子元素,并且不是带键的Fragment,那么它就是多余的。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment。

如果Fragment只包含一个子元素,或者它是一个HTML元素的子元素,并且不是一个带键的Fragment,那么它就是多余的。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment

当前代码中使用了一个不必要的Fragment。建议直接返回空元素。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment

如果Fragment只包含一个子元素,或者它是一个HTML元素的子元素,并且不是带键的Fragment,那么它是多余的。建议直接导出空元素。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的 Fragment。

如果 Fragment 仅包含一个子元素,或者它是 HTML 元素的子元素且不是带键的 Fragment,则它是多余的。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment

当前代码中使用的Fragment是多余的,因为它只包含一个子元素。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment

此处的Fragment是多余的,因为它没有包含任何子元素。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment

如果Fragment只包含一个子元素,或者它是一个HTML元素的子元素,并且不是一个带键的Fragment,那么这个Fragment是多余的。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

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

Outside diff range, codebase verification and nitpick comments (9)
packages/nutui-taro-demo/src/business/pages/avatarcropper/index.tsx (1)

1-1: 避免使用不必要的Fragment

当前文件仅导出一个空的Fragment,这是不必要的,可以直接删除Fragment。

- export default <></>;
+ export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

packages/nutui-taro-demo/src/business/pages/barrage/index.tsx (1)

1-1: 避免使用不必要的Fragment

当前文件仅导出一个空的Fragment,这是不必要的,可以直接删除Fragment。

- export default <></>;
+ export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

packages/nutui-taro-demo/src/business/pages/card/index.tsx (1)

1-1: 避免使用不必要的Fragment

当前文件仅导出一个空的Fragment,这是不必要的,可以直接删除Fragment。

- export default <></>;
+ export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

packages/nutui-taro-demo/src/dentry/pages/checkbox/index.tsx (1)

1-1: 避免使用不必要的Fragment

此处的Fragment是多余的,因为它没有包含任何子元素。

- export default <></>;
+ export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

packages/nutui-taro-demo/src/dentry/pages/datepicker/index.tsx (1)

1-1: 避免使用不必要的Fragment

此处的Fragment是多余的,因为它没有包含任何子元素。

- export default <></>;
+ export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

packages/nutui-taro-demo/src/dentry/pages/form/index.tsx (1)

1-1: 避免使用不必要的Fragment

此处的Fragment是多余的,因为它没有包含任何子元素。

- export default <></>;
+ export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

packages/nutui-taro-demo/src/dentry/pages/textarea/index.tsx (1)

1-1: 避免使用不必要的Fragment。

当前的Fragment是多余的,因为它只包含一个子元素。可以直接导出 null 或一个空组件。

- export default <></>;
+ export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

packages/nutui-taro-demo/src/dentry/pages/uploader/index.tsx (1)

1-1: 避免使用不必要的Fragment。

当前的Fragment是多余的,因为它只包含一个子元素。可以直接导出 null 或一个空组件。

- export default <></>;
+ export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

packages/nutui-taro-demo/src/exhibition/pages/animate/index.tsx (1)

1-1: 避免使用不必要的Fragment。

当前的Fragment是多余的,因为它只包含一个子元素。可以直接导出 null 或一个空组件。

- export default <></>;
+ export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的 Fragment

如果 Fragment 只包含一个子元素,或者它是一个 HTML 元素的子元素,并且不是一个带键的 Fragment,那么它是多余的。建议直接导出空元素。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment

当前的Fragment是多余的,因为它没有包含任何子元素。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

移除不必要的Fragment

此文件仅导出一个空的Fragment,这是多余的。建议移除Fragment或者添加实际内容。

- export default <></>;
+ // Add actual content or remove this file if not needed.

Committable suggestion was skipped due to low confidence.

Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment

当前的Fragment是多余的,因为它没有包含任何子元素。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

移除不必要的Fragment

此文件仅导出一个空的Fragment,这是多余的。建议移除Fragment或者添加实际内容。

- export default <></>;
+ // Add actual content or remove this file if not needed.

Committable suggestion was skipped due to low confidence.

Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

@@ -0,0 +1 @@
export default <></>;
Copy link

Choose a reason for hiding this comment

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

避免使用不必要的Fragment

当前的Fragment是多余的,因为它没有包含任何子元素。

- export default <></>;
+ export default null;
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
export default <></>;
export default null;
Tools
Biome

[error] 1-1: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.

(lint/complexity/noUselessFragments)

}

.index-header .info .h5-h1 {
&_header {
Copy link
Collaborator

Choose a reason for hiding this comment

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

_ 建议统一改为 -

const gotoNext = (name: string, enName: string) => {
// 跳转到目的页面,打开新页面
Taro.navigateTo({
url: `/${enName}/pages/${name.toLocaleLowerCase()}/index`,
})
}

const onShareAppMessage = (res) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

没有这个方法,应该是无法触发 分享~~

Copy link
Collaborator Author

@irisSong irisSong Jul 24, 2024

Choose a reason for hiding this comment

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

没有这个方法,应该是无法触发 分享~~

已还原

@@ -839,7 +839,7 @@
"author": "szg2008"
},
{
"version": "3.0.0",
"version": "2.0.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个合并了~~ 可以合一下dev

@@ -4,12 +4,5 @@ deploy_versions/
.rn_temp/
node_modules/
.DS_Store
src/base/
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个是不是 后边就不用关注了·~
现在只是需要在开发中的原因?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

需要,因为兼容RN未适配的组件不开入口

已修改

const { remove, ensureDir } = require('fs-extra')
const fs = require('fs')

const home = os.homedir()
Copy link
Collaborator

Choose a reason for hiding this comment

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

改到项目的相对路径比较好~~
另外这个所有人都可以访问吗。所有人都可以执行成功么

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

Outside diff range, codebase verification and nitpick comments (3)
scripts/taro/generate-taro-pages.js (3)

Line range hint 41-43:
错误处理不当

fs.mkdirSync的回调中处理错误是无效的,建议直接捕获异常。

- fs.mkdirSync(dirPath, { recursive: true }, (err) => {
-   console.log('mkdir error', err)
- })
+ try {
+   fs.mkdirSync(dirPath, { recursive: true })
+ } catch (err) {
+   console.log('mkdir error', err)
+ }

Line range hint 69-69:
硬编码的文件路径

建议将文件路径作为可配置参数传递,以提高代码的灵活性和可维护性。

const dirPath = path.join(__dirname, process.env.APP_DIR || `../../packages/nutui-taro-demo/src`)

Line range hint 75-75:
潜在的fse.outputFile问题

fse.outputFile中,fileString未被修改,建议使用修改后的lines数组。

const newFileString = lines.join('\n')
fse.outputFile(filePath, newFileString, 'utf8', (error) => {
  if (error) console.log('Error', error)
})

const temp = `${process.cwd()}/packages`

async function cloneJdHarmony() {
const remote = '[email protected]:DongDesign/JDHarmony.git'
Copy link

Choose a reason for hiding this comment

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

硬编码的git远程URL

建议将远程URL作为函数参数传递,以提高代码的灵活性和可维护性。

async function cloneJdHarmony(remote = '[email protected]:DongDesign/JDHarmony.git', branch = 'master') {
  // ...
}

const harmonyPathNew = path.join(temp, 'nutui-jdharmony')
await remove(harmonyPathNew)
await ensureDir(harmonyPathNew)
fs.renameSync(harmonyPath, harmonyPathNew)
Copy link

Choose a reason for hiding this comment

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

避免使用同步的fs.renameSync

建议使用异步方法fs.rename来避免阻塞事件循环。

await fs.promises.rename(harmonyPath, harmonyPathNew)


// 判断temp目录是否存在JDHarmony文件夹,如果不存在不存在则执行clone()

const harmonyPath = path.join(temp, 'nutui-jdharmony')
Copy link

Choose a reason for hiding this comment

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

硬编码的目录路径

建议将目录路径作为可配置参数传递,以提高代码的灵活性和可维护性。

const harmonyPath = path.join(temp, process.env.HARMONY_DIR || 'nutui-jdharmony')

Comment on lines +37 to +39
if (!fs.existsSync(harmonyPath)) {
clone()
console.log(`Clone JDHarmony successfully.`)
Copy link

Choose a reason for hiding this comment

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

潜在的竞争条件

在检查目录是否存在和创建目录之间可能存在竞争条件,建议使用fs-extraensureDir方法。

const harmonyPath = path.join(temp, 'nutui-jdharmony')
ensureDir(harmonyPath).then(() => {
  console.log(`JDHarmony already exists.`)
}).catch(() => {
  clone().then(() => {
    console.log(`Clone JDHarmony successfully.`)
  })
})

@@ -17,7 +28,7 @@ const createIndexConfig = (enName, package) => {
if (package.show && package.taro) {
const name = package.name
const nameLc = package.name.toLowerCase()
let content = `export default {
const content = `export default {
Copy link

Choose a reason for hiding this comment

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

硬编码的文件路径

建议将文件路径作为可配置参数传递,以提高代码的灵活性和可维护性。

const dirPath = path.join(__dirname, process.env.DEMO_DIR || `../../packages/nutui-taro-demo/src/${enName}/pages/${nameLc}`)
Tools
Biome

[error] 31-31: Illegal use of reserved keyword package as an identifier in strict mode

(parse)

Comment on lines +53 to +54
const demoContent = adaptedArray.includes(nameLc)
? `import Demo from '@/packages/${nameLc}/demo.taro';
Copy link

Choose a reason for hiding this comment

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

潜在的竞争条件

在生成配置文件和生成demo文件之间可能存在竞争条件,建议使用异步方法并链式调用。

fs.promises.writeFile(filePath, content)
  .then(() => {
    console.log(`生成index.config.ts文件成功`)
    return fs.promises.writeFile(demoFilePath, demoContent)
  })
  .then(() => {
    console.log(`生成 index.tsx 文件成功`)
  })
  .catch((err) => {
    console.error('Error', err)
  })

adaptedArray.push(element.name.toLowerCase())
})
})

const navs = config.nav

// let fileStr = `@import '../../../styles/font/iconfont.css';`
Copy link

Choose a reason for hiding this comment

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

非法使用保留关键字package

在严格模式下,package是保留关键字,建议更换变量名。

- const createIndexConfig = (enName, package) => {
+ const createIndexConfig = (enName, pkg) => {

Committable suggestion was skipped due to low confidence.

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