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: replace github-contributors-lists plugin #257

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .dumi/theme/slots/Content/ContributorAvatar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import type { AvatarListItem } from '@qixian.cs/github-contributors-list/dist/AvatarList';
import { Avatar, Skeleton, Tooltip } from 'antd';
import type { AvatarListItem } from 'github-contributors-lists';
import React from 'react';

const AvatarPlaceholder: React.FC<{ num?: number }> = ({ num = 3 }) => (
<li>
Expand Down
2 changes: 1 addition & 1 deletion .dumi/theme/slots/Content/Contributors.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ContributorsList from '@qixian.cs/github-contributors-list';
import { createStyles } from 'antd-style';
import classNames from 'classnames';
import { useIntl } from 'dumi';
import ContributorsList from 'github-contributors-lists';
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

需要添加 github-contributors-lists 包到项目依赖中

package.json 中缺少 github-contributors-lists 依赖,但代码中已经在使用这个包。这可能会导致构建失败或运行时错误。请:

  • 运行 npm install github-contributors-lists --saveyarn add github-contributors-lists 添加依赖
  • 确保添加的版本为 ^1.0.3(根据之前的搜索结果)
🔗 Analysis chain

请验证新包的兼容性和稳定性

新引入的 github-contributors-lists 包替换了原有的 @qixian.cs/github-contributors-list,建议进行以下验证:

  • 确保新包的 API 接口与原包完全兼容
  • 验证新包在生产环境中的稳定性
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查新包的使用情况和依赖关系

# 查找项目中所有使用此包的地方
rg "github-contributors-lists"

# 检查 package.json 中的版本信息
cat package.json | jq '.dependencies["github-contributors-lists"]'

Length of output: 160


Script:

#!/bin/bash
# 检查原包的使用情况
rg "@qixian.cs/github-contributors-list"

# 检查 Contributors 组件的实现细节
cat .dumi/theme/slots/Content/Contributors.tsx

# 检查 package.json 的完整依赖
cat package.json | jq '.dependencies'

Length of output: 2044

Copy link
Member

Choose a reason for hiding this comment

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

这个是直接前端请求 github api,会被限流吧?

Copy link
Author

Choose a reason for hiding this comment

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

web3 那边用了半年了,暂时没遇到什么大的问题,而且在代码部分基本保持一致,可以临时用一下试试。 照理说这些 api 只跟用户有关吧,跟打开 github 在线链接能看到谁修改差不多的吧。不要刷的太频繁基本没影响,人工网站路由切换的话应该不会封。
image

Copy link
Member

Choose a reason for hiding this comment

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

图片

刷一会就不够用了。

Copy link
Member

Choose a reason for hiding this comment

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

不如等 @chenshuai2144 修复 @qixian.cs/github-contributors-list

Copy link
Author

@thinkasany thinkasany Nov 27, 2024

Choose a reason for hiding this comment

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

其实应该没这么容易刷完,这个组件也是懒加载的,不滑到底部不会请求。然后过一个小时会刷新限制。 感觉可以让期贤大佬评估一下,有没有必要修,如果可以直接用的话,也更省时间,原理应该都差不多,肯定用的是github的api去查更改过的用户,如果是这么做的话其实也一样都会有limit。
image

Copy link
Member

Choose a reason for hiding this comment

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

@qixian.cs/github-contributors-list 已经修复了。

图片

import React, { useContext } from 'react';

import SiteContext from '../SiteContext';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"@microflash/rehype-figure": "^2.1.1",
"@npmcli/run-script": "^9.0.1",
"@octokit/rest": "^21.0.2",
"@qixian.cs/github-contributors-list": "^2.0.2",
"github-contributors-lists": "^1.0.3",
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

不建议使用 github-contributors-lists 依赖包

基于验证结果,发现以下严重问题:

  1. 该包在 npm 仓库中无法获取到任何基本信息(发布时间、下载量、维护者等)
  2. 在代码库中仅在 package.json 中发现引用,没有实际使用代码
  3. 包的可用性和可靠性无法得到验证

建议:

  • 建议回退此更改,继续使用原有的 @qixian.cs/github-contributors-list
  • 或者寻找其他更可靠的替代方案来解决头像显示问题
🔗 Analysis chain

请验证新依赖包的可靠性和兼容性

关于将 @qixian.cs/github-contributors-list 替换为 github-contributors-lists 的变更,需要注意以下几点:

  1. 新包的版本(1.0.3)相对较低,建议验证其稳定性和维护状态
  2. 由于是不同的包,需要确认 API 接口的兼容性
  3. 建议在合并前在测试环境完整验证新包的功能

Let me verify the package usage in the codebase before making the final response.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查新包的发布时间、下载量和最新版本
echo "检查 github-contributors-lists 包的基本信息:"
curl -s https://api.npms.io/v2/package/github-contributors-lists | jq '{
    "最后发布时间": .collected.metadata.date,
    "周下载量": .collected.npm.downloads[0].count,
    "最新版本": .collected.metadata.version,
    "维护者数量": (.collected.metadata.maintainers | length)
}'

# 检查是否存在已知的安全漏洞
echo -e "\n检查安全漏洞:"
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NPM, package: "github-contributors-lists") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
    }
  }
}'

Length of output: 746


Script:

#!/bin/bash
# 检查当前包的使用情况
echo "在代码库中搜索 github-contributors-lists 的使用:"
rg -l "github-contributors-lists" --type js --type ts --type jsx --type tsx

echo -e "\n检查原包 @qixian.cs/github-contributors-list 的使用:"
rg -l "@qixian.cs/github-contributors-list" --type js --type ts --type jsx --type tsx

# 检查 package-lock.json 中的相关信息
echo -e "\n检查 package-lock.json 中的包信息:"
if [ -f "package-lock.json" ]; then
    jq '.dependencies["github-contributors-lists"] // .packages["node_modules/github-contributors-lists"]' package-lock.json
fi

Length of output: 513


Script:

#!/bin/bash
# 修正文件类型并重新搜索
echo "在代码库中搜索 github-contributors-lists 的使用:"
rg -l "github-contributors-lists"

echo -e "\n检查原包 @qixian.cs/github-contributors-list 的使用:"
rg -l "@qixian.cs/github-contributors-list"

# 检查 package.json 中的相关信息
echo -e "\n检查 package.json 中的依赖配置:"
if [ -f "package.json" ]; then
    jq '.dependencies["github-contributors-lists"], .dependencies["@qixian.cs/github-contributors-list"]' package.json
fi

# 检查是否有相关的文档或配置
echo -e "\n搜索相关配置文件:"
fd -g "*contributors*" -t f

Length of output: 565

"@rc-component/father-plugin": "1.2.0-alpha.0",
"@rc-component/trigger": "^2.2.3",
"@size-limit/file": "^11.1.5",
Expand Down