Skip to content

Commit

Permalink
feat: Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nepsyn committed Nov 15, 2024
1 parent 92ead27 commit 9554a43
Show file tree
Hide file tree
Showing 23 changed files with 2,072 additions and 1,971 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install pnpm
run: npm install pnpm --global
working-directory: packages/docs
- name: Install dependencies
run: npm ci
run: pnpm install
working-directory: packages/docs
- name: Build with VitePress
run: npm run docs:build
run: pnpm run docs:build
working-directory: packages/docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
5 changes: 4 additions & 1 deletion packages/docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import { zh } from './zh.mjs';
export default defineConfig({
title: 'MinaPlay',
description: 'MinaPlay official document',
rewrites: {
'zh/:rest*': ':rest*'
},
lastUpdated: true,
base: '/minaplay/',
srcExclude: ['README.md'],
head: [
['script', {
defer: true,
defer: '',
src: 'https://us.umami.is/script.js',
'data-website-id': '6de8215f-84d9-4fc9-a6ca-f6850d2ebb2b',
}],
Expand Down
98 changes: 62 additions & 36 deletions packages/docs/.vitepress/zh.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vitepress';
import { DefaultTheme, defineConfig } from 'vitepress';

export const zh = defineConfig({
lang: 'zh-Hans',
Expand All @@ -12,6 +12,7 @@ export const zh = defineConfig({
},
outline: {
label: '页面导航',
level: 'deep',
},
lastUpdated: {
text: '最后更新于',
Expand All @@ -20,42 +21,16 @@ export const zh = defineConfig({
timeStyle: 'medium',
},
},
nav: [
{ text: '快速开始', link: '/guide/getting-started' },
{ text: '指南', link: '/guide/rss-source' },
],
nav: nav(),
sidebar: {
'/guide/': [
{
text: '简介',
collapsed: false,
items: [
{ text: '什么是 MinaPlay?', link: '/guide/what-is-minaplay' },
{ text: '快速开始', link: '/guide/getting-started' },
{ text: '部署', link: '/guide/deploy' },
{ text: '启动参数', link: '/guide/env' },
],
},
{
text: '指南',
collapsed: false,
items: [
{ text: 'RSS 订阅源', link: '/guide/rss-source' },
{ text: '订阅规则', link: '/guide/rule' },
{ text: '放映室', link: '/guide/live' },
{ text: '插件', link: '/guide/plugin' },
],
},
{
text: '资源',
collapsed: false,
items: [
{ text: 'FAQ', link: '/guide/faq' },
{ text: '常用订阅规则', link: '/guide/common-rules' },
{ text: '代理配置', link: '/guide/proxy' },
],
},
],
'/guide/': {
base: '/guide/',
items: sidebarGuide(),
},
'/reference/': {
base: 'reference/',
items: sideBarReference(),
},
},
footer: {
message: '基于 AGPL-3.0 发布',
Expand All @@ -64,3 +39,54 @@ export const zh = defineConfig({
socialLinks: [{ icon: 'github', link: 'https://github.com/nepsyn/minaplay' }],
},
});

function nav(): DefaultTheme.NavItem[] {
return [
{ text: '快速开始', link: '/guide/getting-started' },
{ text: '指南', link: '/guide/rss-source' },
{ text: '参考', link: '/reference/notification' },
];
}

function sidebarGuide(): DefaultTheme.SidebarItem[] {
return [
{
text: '简介',
collapsed: false,
items: [
{ text: '什么是 MinaPlay?', link: 'what-is-minaplay' },
{ text: '快速开始', link: 'getting-started' },
{ text: '部署', link: 'deploy' },
],
},
{
text: '指南',
collapsed: false,
items: [
{ text: 'RSS 订阅', link: 'subscribe' },
{ text: '放映室', link: 'live' },
{ text: '插件', link: 'plugin' },
],
},
{
text: '资源',
collapsed: false,
items: [
{ text: '启动参数', link: 'env' },
{ text: 'FAQ', link: 'faq' },
{ text: '常用订阅规则', link: 'common-rules' },
{ text: '代理配置', link: 'proxy' },
],
},
];
}

function sideBarReference(): DefaultTheme.SidebarItem[] {
return [
{
text: '参考',
collapsed: false,
items: [{ text: '通知服务', link: 'notification' }],
},
];
}
8 changes: 4 additions & 4 deletions packages/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ MinaPlay docs 是 MinaPlay 使用 [VitePress](https://vitepress.dev/zh/) 构建

### 项目依赖

- [Node.js](https://nodejs.org/en) (版本 >= 18) & npm
- [Node.js](https://nodejs.org/en) (版本 >= 18) & pnpm

### 开始

Expand All @@ -36,17 +36,17 @@ MinaPlay docs 是 MinaPlay 使用 [VitePress](https://vitepress.dev/zh/) 构建
2. 使用包管理器安装依赖。

```shell
npm install
pnpm install
```

3. 在本地开发环境启动 MinaPlay 文档。

```shell
npm run docs:dev
pnpm run docs:dev
```

4. 编译 MinaPlay 文档

```shell
npm run docs:build
pnpm run docs:build
```
114 changes: 0 additions & 114 deletions packages/docs/guide/env.md

This file was deleted.

2 changes: 0 additions & 2 deletions packages/docs/guide/faq.md

This file was deleted.

1 change: 0 additions & 1 deletion packages/docs/guide/proxy.md

This file was deleted.

Loading

0 comments on commit 9554a43

Please sign in to comment.