@cssnr/vitepress-plugin-contributors

中文文档
0.2.0发布于 2026/04/20GPL-3.0-onlyTypeScriptESM + CJS构建来源已验证近 30 天下载 5503

VitePress 插件以方便生成,更新并显示 GitHub 贡献者 。 自动更新每次安装或部署的自定义选项.

中文使用文档
文档目录6 节
  1. 安装
  2. 使用量
  3. 选项
  4. 演示文稿
  5. 支助
  6. 更多虚拟新闻插件

NPM Version GitHub Release Version NPM Downloads Bundlephobia Size Deployments NPM Deployments Docs Workflow Release Workflow Lint GitHub Last Commit GitHub Repo Size GitHub Top Language GitHub Contributors GitHub Issues GitHub Discussions GitHub Forks GitHub Repo Stars GitHub Org Stars Discord Ko-fi

VitePress 插件贡献器

VitePress Plugin Contributors

A 类 虚拟新闻 用于轻松生成、更新和显示寄存器的插件. 支持GitHub(包括企业)和Forgejo(Gitea,Codeberg等).

这个 软件包 包括可以一起或单独使用的两个组件.

  1. 获得贡献者 - 生成 contributors.json 文档.
  2. 贡献者.vue - 在VitePress中显示贡献者的组件.

还包括一个详细的 安装 可用指南 支助。 。 。 .

View Documentation

安装

View Install Guide

  1. 直接安装到您的 VitePress 从 无。 。 。 .
npm i @cssnr/vitepress-plugin-contributors
  1. 添加数据 获得贡献者 脚本到您的 package.json。 。 。 .
{
  "scripts": {
    "get-contributors": "npx get-contributors user/repo",
    "postinstall": "npm run get-contributors"
  }
}

如果你们不添加 postinstall 您需要添加脚本 get-contributors 到你的建筑.

点击这里查看使用量 - 获得贡献者

View Get Contributors Docs

显示帮助 : npx get-contributors -h

基本用途,所有贡献者不包括机器人用户.

npx get-contributors user/repo

限制为前20名贡献者,指定输出文件,并包括bot用户.

npx get-contributors user/repo -m 20 -f .vitepress/contributors.json -b

只有 user/repo 需要时间。 所有其他论点都是可选的.

参数旗默认值参数描述
-f编号 :--file.vitepress/contributors.json相对于工程根输出文件
-m编号 :--max-users0要获取的最大用户, 0 是无限的
-b编号 :--bots- 说吧将机器人用户纳入结果
-e编号 :--error- 说吧生成时丢出错误
-k编号 :--keyslogin,avatar_url要保存到文件的密钥
-G编号 :--githubhttps://api.github.comGitHub API URL( 用于企业)
-F编号 :--forgejo- 说吧Forgejo API URL(给吉特亚/科德伯格)

说明: 此脚本向 GitHub API 提出一个请求, 每100名寄件者在寄存器( 或 max-users) (中文(简体) ). 因为如果你有很多贡献者(200+) 运行在背对背上,可能会被击中 页:1 GitHub 利率限制 对未经认证的请求,即每小时60个请求. 如果发生这种情况, 脚本将生成一个部分或空的投稿人, 这样可以继续开发 .

这不影响 GitHub 动作运行,这些运行被认证为 GTIHUB_TOKEN。 。 。 .


  1. 添加数据 contributors.json 文件位置到您的 .gitignore。 。 。 .
.vitepress/contributors.json
  1. 生成 contributors.json 文档.
npm run get-contributors

或者,如果你没有添加 get-contributors 第2步的脚本.

npx get-contributors user/repo
  1. 导入您的组件 .vitepress/theme/index.js。 。 。 .
import DefaultTheme, { VPBadge } from 'vitepress/theme' // only if using VPBadge

import Contributors from '@cssnr/vitepress-plugin-contributors' // ADD this line
import '@cssnr/vitepress-plugin-contributors/style.css' // ADD this line

import contributors from '../contributors.json' // OPTIONAL - Global

export default {
  ...DefaultTheme,
  enhanceApp({ app }) {
    app.component('Badge', VPBadge) // only if using VPBadge
    app.component('Contributors', Contributors) // ADD this line
    app.config.globalProperties.$contributors = contributors // OPTIONAL - Global
  },
}

Global - 如果你不确定这一点 使用量中,添加这些行以简单化.

VPBadge - 只有在您使用 VitePress 时才需要 徽标。 。 。 .

更多细节 贡献者.json 路径

注意,你可能需要修改 ../contributors.json 导入位置以匹配您的设置 . 如果您的 VitePress 配置目录位于 .vitepress 然后是默认输出 路径 .vitepress/contributors.json 从相对路径导入 ../contributors.json。 。 。 .

如果您没有导入 contributors 作为环球,此路径将相对于您导入的文件 .
见 使用量 更多细节.


  1. 最后,请使用 贡献者.vue 图标.
<Contributors :contributors="$contributors" />

见 使用量 更多细节...

使用量

View Usage Guide

要使用,只需添加 <Contributors> 标记到你的标记下的文件(或组件).

如果你添加的话 contributors 作为全球的组成部分,你只需要 <Contributors> 标签.

<Contributors :contributors="$contributors" />

否则,导入 contributors.json 添加一个 <Contributors> 标签.

<script setup>
import contributors from '../.vitepress/contributors.json'
</script>

<Contributors :contributors="contributors" />

这个 contributors.json 文件相对于您导入的文件.

见 选项 更多细节...

选项

View Contributors Docs

只有 :contributors 需要参数,其他的都是可选的.

参数默认类型参数说明
: 贡献者需求阵列contributors.json 文件导入数据
最大用户- 说吧字符串要显示的用户数
标题- 说吧字符串可选标题文本
大小64字符串用像素表示的图标大小
边距- 说吧字符串CSS 比值 容器字符串

以所有论据为例.

<Contributors
    :contributors="$contributors"
    heading="VitePress Contributors"
    max-users="98"
    size="48"
    margin="36px 0 96px"
/>

VitePress Contributors

演示文稿

插件正在这些页面上运行 :

如果你有现场演示, 告诉我们 我们把它放在这里...

支助

日志可以查看页面(Ctrl+Shift+I),点击控制台; Firefox:将调试日志,Chrome:将Verbose从水平降下.

如果您遇到任何问题或需要帮助,请做以下一项:

Features Issues Discussions Discord

更多虚拟新闻插件

捐款

欢迎所有捐款,包括: 错误报告, (中文(简体) ), 特性请求,或调取请求.

用于创建 PR 的指令 软件包 或者说 文档, (中文(简体) ), 见 捐款额。 。 。 .

请考虑捐款支持该项目和更多开放源码项目的发展.

Ko-fi

关于目前项目访问的完整清单: https://cssnr.github.io/ (中文(简体) )

Star History Chart

版本与发布记录

@cssnr/vitepress-plugin-contributors 共发布 7 个版本,首次发布于 2025/09/13;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.2.0latest2026/04/206 个月前
0.1.02026/04/146 个月前
0.0.52025/10/311 年前
0.0.42025/09/241.1 年前
0.0.32025/09/141.2 年前
0.0.22025/09/131.2 年前

关于 @cssnr/vitepress-plugin-contributors 的常见问题

@cssnr/vitepress-plugin-contributors 是什么?

VitePress 插件以方便生成,更新并显示 GitHub 贡献者 。 自动更新每次安装或部署的自定义选项.

如何安装 @cssnr/vitepress-plugin-contributors?

在项目目录运行 npm install @cssnr/vitepress-plugin-contributors,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 get-contributors,可以用 npx get-contributors 直接运行。

@cssnr/vitepress-plugin-contributors 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cssnr/vitepress-plugin-contributors 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@cssnr/vitepress-plugin-contributors 可以商用吗?

@cssnr/vitepress-plugin-contributors 使用 GPL-3.0-only 许可。强 Copyleft:分发包含该代码的软件时,整个作品需以 GPL-3.0 兼容许可开源,并附带专利与反锁定条款。仅内部使用不触发此义务。以上为概括,不构成法律意见,请以许可原文为准。

@cssnr/vitepress-plugin-contributors 的下载量有多少?

根据 npm 官方下载统计,@cssnr/vitepress-plugin-contributors 在 2026/10/11 – 2026/11/09 这 30 天内被下载 5,503 次,日均约 183 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cssnr/vitepress-plugin-contributors 还在维护吗?

最新版本 0.2.0 发布于 2026/04/20(6 个月前);至今共发布 7 个版本,其中过去 12 个月发布了 2 个;首次发布于 2025/09/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。