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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e488ef3
Update infiniteloading.taro.tsx
jqroom Jan 30, 2024
bab59d4
Update infiniteloading.tsx
jqroom Jan 30, 2024
783598d
Merge branch 'next' into next
jqroom Jan 30, 2024
4cae5eb
Merge branch 'jdf2e:next' into next
jqroom Aug 22, 2024
f134285
fix(tabs.taro.tsx): 解决在不需要滚动的时候,切换tab产生tab位置错乱的问题
jqroom Aug 22, 2024
978ef72
fix(tabs.taro.tsx): 解决页面元素不需要滚动时,切换tab,tab顺序发生不可预知的变化的问题
jqroom Aug 22, 2024
12d1ef9
Update tabs.taro.tsx
jqroom Aug 23, 2024
ff328a4
Update tabs.taro.tsx
jqroom Aug 23, 2024
5b38d72
Merge branch 'jdf2e:next' into next
jqroom Oct 24, 2024
9ce77c4
feat: 增加 demo 场景
jqroom Oct 25, 2024
d55d011
feat: 增加icon替换插件
jqroom Oct 28, 2024
d234438
feat: 增加sourceLibrary参数配置
jqroom Oct 28, 2024
19e3d77
Merge pull request #1 from jqroom/feature-replace-icon
jqroom Oct 28, 2024
7da214f
Merge branch 'next' into next
jqroom Oct 28, 2024
a61eaff
feat: 增加lock file
jqroom Oct 29, 2024
e87eef0
feat: 修改包路径
jqroom Oct 29, 2024
15d3cc5
Revert "feat: 增加 demo 场景"
jqroom Oct 29, 2024
1a02395
feat(babel.config.js): 只替换jmapp
jqroom Oct 29, 2024
1ebe2f4
feat(npmrc): 修改npm源
jqroom Oct 29, 2024
3b0458f
Merge branch 'jdf2e:next' into next
jqroom Oct 29, 2024
8fa2d97
Merge branch 'next' into feature-replace-icon
jqroom Oct 29, 2024
292ae79
feat: 同步pnpm lock
jqroom Oct 29, 2024
40d8c1d
feat: 调整版本号@nutui/replace-icons
jqroom Oct 29, 2024
c069154
feat: 移除子目录的npmrc
jqroom Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
registry=https://registry.npmjs.org/
engine-strict=true
strict-peer-dependencies=false

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/jdesign-icons-react-taro@1.0.6-beta.2 是测试版本,建议:

  • 考虑继续使用现有的稳定版本图标库
  • 或等待 @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

"@nutui/touch-emulator": "^1.0.0",
"@react-spring/web": "~9.6.1",
"@use-gesture/react": "10.2.20",
Expand All @@ -118,7 +119,6 @@
"@commitlint/cli": "^19.0.3",
"@commitlint/config-conventional": "^19.0.3",
"@loadable/component": "^5.16.3",
"prettier-markdown-table": "^1.0.2",
"@mdx-js/mdx": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@mdx-js/rollup": "^3.0.1",
Expand Down Expand Up @@ -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",

"react": "^18.2.0",
"react-color": "^2.19.3",
"react-dom": "^18.2.0",
Expand Down
11 changes: 10 additions & 1 deletion packages/nutui-taro-demo/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// babel-preset-taro 更多选项和默认值:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
const replaceIcons = require('@nutui/replace-icons')
const projectID = process.env.VITE_APP_PROJECT_ID

module.exports = {
presets: [
[
Expand All @@ -12,5 +15,11 @@ module.exports = {
],
plugins: [
['@babel/plugin-transform-typescript', { allowDeclareFields: true }],
],
projectID === 'jmapp' && [
replaceIcons({
sourceLibrary: ['@nutui/icons-react-taro', '@nutui/icons-react'],
targetLibrary: '@nutui/jdesign-icons-react-taro',
}),
],
].filter(Boolean),
Comment on lines +18 to +24
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

}
2 changes: 1 addition & 1 deletion packages/nutui-taro-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"author": "",
"dependencies": {
"@babel/runtime": "^7.23.9",
"@nutui/replace-icons": "^1.0.0",
"@nutui/touch-emulator": "^1.0.0",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
"@tarojs/components": "3.6.22",
Expand All @@ -68,7 +69,6 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-refresh": "^0.14.0"

},
"devDependencies": {
"@babel/core": "^7.23.9",
Expand Down
Loading
Loading