Skip to content

Commit a67a368

Browse files
committed
Initial commit: NapLink documentation site
- VitePress 配置 - 完整的指南文档 (9个) - 完整的 API 参考文档 (5个) - GitHub Actions 自动部署工作流 - 包含简介、快速开始、配置、API调用、事件处理、错误处理、最佳实践、架构设计、SDK对比等内容
0 parents  commit a67a368

22 files changed

Lines changed: 6642 additions & 0 deletions

.github/workflows/deploy.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy VitePress site to Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup Node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20
30+
cache: npm
31+
32+
- name: Setup Pages
33+
uses: actions/configure-pages@v4
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Build with VitePress
39+
run: npm run build
40+
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: docs/.vitepress/dist
45+
46+
deploy:
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
needs: build
51+
runs-on: ubuntu-latest
52+
name: Deploy
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
.vitepress/cache
4+
.vitepress/dist

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# NapLink Documentation
2+
3+
> NapLink SDK 官方文档站点(基于 VitePress)
4+
5+
## 本地开发
6+
7+
```bash
8+
# 安装依赖
9+
npm install
10+
11+
# 启动开发服务器
12+
npm run dev
13+
14+
# 构建
15+
npm run build
16+
17+
# 预览构建结果
18+
npm run preview
19+
```
20+
21+
## 目录结构
22+
23+
```
24+
docs/
25+
├── .vitepress/
26+
│ └── config.ts # VitePress 配置
27+
├── guide/ # 指南文档
28+
│ ├── index.md # 简介
29+
│ ├── getting-started.md
30+
│ ├── configuration.md
31+
│ └── ...
32+
├── api/ # API 文档
33+
│ ├── index.md
34+
│ ├── naplink.md
35+
│ └── ...
36+
└── index.md # 首页
37+
```
38+
39+
## 部署
40+
41+
文档会自动部署到 GitHub Pages。
42+
43+
## 许可证
44+
45+
MIT

docs/.vitepress/config.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { defineConfig } from 'vitepress';
2+
3+
export default defineConfig({
4+
title: 'NapLink',
5+
description: '现代化的 NapCat WebSocket 客户端 SDK',
6+
base: '/naplink/',
7+
8+
themeConfig: {
9+
logo: '/logo.svg',
10+
11+
nav: [
12+
{ text: '指南', link: '/guide/index' },
13+
{ text: 'API', link: '/api/index' },
14+
{ text: 'GitHub', link: 'https://github.com/magisk317/naplink' }
15+
],
16+
17+
sidebar: {
18+
'/guide/': [
19+
{
20+
text: '开始',
21+
items: [
22+
{ text: '简介', link: '/guide/index' },
23+
{ text: '快速开始', link: '/guide/getting-started' },
24+
{ text: '配置', link: '/guide/configuration' },
25+
]
26+
},
27+
{
28+
text: '进阶',
29+
items: [
30+
{ text: 'API 调用', link: '/guide/api' },
31+
{ text: '事件处理', link: '/guide/events' },
32+
{ text: '错误处理', link: '/guide/errors' },
33+
{ text: '最佳实践', link: '/guide/best-practices' },
34+
]
35+
},
36+
{
37+
text: '参考',
38+
items: [
39+
{ text: '架构设计', link: '/guide/architecture' },
40+
{ text: '与其他 SDK 对比', link: '/guide/comparison' },
41+
]
42+
}
43+
],
44+
'/api/': [
45+
{
46+
text: 'API 文档',
47+
items: [
48+
{ text: '概览', link: '/api/index' },
49+
{ text: 'NapLink 类', link: '/api/naplink' },
50+
{ text: '配置选项', link: '/api/config' },
51+
{ text: '错误类型', link: '/api/errors' },
52+
{ text: 'OneBot API', link: '/api/onebot' },
53+
]
54+
}
55+
]
56+
},
57+
58+
socialLinks: [
59+
{ icon: 'github', link: 'https://github.com/magisk317/naplink' }
60+
],
61+
62+
footer: {
63+
message: 'Released under the MIT License.',
64+
copyright: 'Copyright © 2024 NapLink Contributors'
65+
},
66+
67+
search: {
68+
provider: 'local'
69+
}
70+
}
71+
});

0 commit comments

Comments
 (0)