@nsnanocat/doc-ui 是供 NSNanoCat 项目的 Rspress 文档站使用的 React 组件包。
ModuleInstall:生成 Loon、Surge、Quantumult X、Stash、Egern 与 Shadowrocket 的模块安装标签页。NavIcon:在 Rspress 导航栏展示 NSNanoCat 项目入口。Contributors:按需加载 GitHub 仓库贡献者及用户信息。@nsnanocat/doc-ui/theme:在 Rspress 默认主题的导航栏中注入NavIcon。
GitHub Packages 需要 GitHub 身份认证。先在项目或用户级 .npmrc 中配置:
@nsnanocat:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKENToken 至少需要 read:packages 权限,然后安装:
npm install @nsnanocat/doc-ui本包要求消费项目提供 React 18、React DOM 18 与 Rspress 1:
npm install react@^18.3.1 react-dom@^18.3.1 rspress@^1.36.0import { Contributors, ModuleInstall } from "@nsnanocat/doc-ui";
<ModuleInstall
urlPrefix="https://example.com/releases/latest/download/"
urls={{
loon: "Example.plugin",
surge: "Example.sgmodule",
}}
/>
<Contributors repo="NSNanoCat/docUI" />在 Rspress 主题入口中直接重新导出:
export { default } from "@nsnanocat/doc-ui/theme";
export * from "@nsnanocat/doc-ui/theme";启动直接读取 src 且支持热更新的 Rspress 调试站:
npm install
npm run dev构建并预览演示站:
npm run demo:build
npm run preview完整检查:
npm run check仓库只发布到 GitHub Packages,不发布到 npm。推送符合 SemVer 的 v* tag 后,GitHub Actions 会使用 tag
中的版本构建并发布:
git tag -a v2.4.2 -m "v2.4.2"
git push origin v2.4.2