Skip to content

Commit 040c61f

Browse files
committed
update docs
1 parent d10fd20 commit 040c61f

File tree

7 files changed

+84
-54
lines changed

7 files changed

+84
-54
lines changed
88.8 KB
Loading
18.7 KB
Loading

docs/.vuepress/sidebar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const mySidebar: ThemeSidebarMulti = {
7474
collapsed: false,
7575
items: [
7676
{ text: '插件开发', link: 'dev' },
77-
{ text: '插件发布', link: 'publish' },
77+
{ text: '插件分享', link: 'share' },
7878
]
7979
},
8080
{

docs/plugin/dev.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,17 @@ title: 插件开发
44

55
## 后端
66

7-
:::: steps
7+
::: steps
88

99
1. 拉取最新的 fba 项目到本地并配置好开发环境
1010
2. 通过 [插件分类](#插件分类)[插件路由结构](#插件路由结构)[插件配置](#插件配置)[数据库兼容性](#数据库兼容性)
1111
了解插件系统的运作机制
1212
3. 根据 [插件目录结构](#插件目录结构) 进行插件开发
1313
4. 完成插件开发
14-
5. 插件分享 <Badge type="warning" text="可选" />
1514

16-
使用插件模板仓库 [fba_plugin_template](https://github.com/fastapi-practices/fba_plugin_template)
17-
创建个人仓库,并将插件代码上传到个人仓库
15+
5. [插件分享](./share.md) <Badge type="warning" text="可选" />
1816

19-
::: warning
20-
请不要将插件代码以 PR 的方式进行提交!
21-
:::
22-
23-
6. [申请发布插件](publish.md) <Badge type="warning" text="可选" />
24-
25-
::::
17+
:::
2618

2719
### 插件分类
2820

@@ -92,25 +84,26 @@ fba 内所有官方实现都同时兼容 mysql 和 postgresql,但我们不对
9284

9385
### 插件目录结构
9486

87+
插件统一放置在 `backend/plugin` 目录下,以下是插件的目录结构
88+
9589
::: file-tree
9690

97-
- backend 固定目录 <Badge type="danger" text="必须" />
98-
- plugin 固定目录 <Badge type="danger" text="必须" />
99-
- xxx 插件名 <Badge type="danger" text="必须" />
100-
- api/ 接口 <Badge type="danger" text="必须" />
101-
- crud/ CRUD <Badge type="warning" text="非必须" />
102-
- model 模型 <Badge type="warning" text="非必须" />
103-
- __init__.py 在此文件内导入所有模型类 <Badge type="danger" text="必须" />
104-
- …
105-
- schema/ 数据传输 <Badge type="warning" text="非必须" />
106-
- service/ 服务 <Badge type="warning" text="非必须" />
107-
- utils/ 工具包 <Badge type="warning" text="非必须" />
108-
- __init__.py 作为 python 包保留 <Badge type="danger" text="必须" />
109-
- conf.py 插件独立配置 <Badge type="warning" text="非必须" />
110-
- … 更多其他配置,例如 enums.py... <Badge type="warning" text="非必须" />
111-
- plugin.toml 插件配置文件 <Badge type="danger" text="必须" />
112-
- README.md 插件使用说明 <Badge type="danger" text="必须" />
113-
- requirements.txt 依赖包文件 <Badge type="warning" text="非必须" />
91+
- xxx 插件名 <Badge type="danger" text="必须" />
92+
- api/ 接口 <Badge type="danger" text="必须" />
93+
- crud/ CRUD <Badge type="warning" text="非必须" />
94+
- model 模型 <Badge type="warning" text="非必须" />
95+
- __init__.py 在此文件内导入所有模型类 <Badge type="danger" text="必须" />
96+
-
97+
- schema/ 数据传输 <Badge type="warning" text="非必须" />
98+
- service/ 服务 <Badge type="warning" text="非必须" />
99+
- utils/ 工具包 <Badge type="warning" text="非必须" />
100+
- __init__.py 作为 python 包保留 <Badge type="danger" text="必须" />
101+
- .env.example 插件环境变量配置示例 <Badge type="warning" text="非必须" />
102+
- conf.py.example 插件独立配置示例 <Badge type="warning" text="非必须" />
103+
- … 更多其他配置,例如 enums.py... <Badge type="warning" text="非必须" />
104+
- plugin.toml 插件配置文件 <Badge type="danger" text="必须" />
105+
- README.md 插件使用说明和您的联系方式 <Badge type="danger" text="必须" />
106+
- requirements.txt 依赖包文件 <Badge type="warning" text="非必须" />
114107

115108
:::
116109

docs/plugin/install.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,42 @@ title: 快速开始
88
@tab 手动
99

1010
1. 获取插件仓库源码并下载
11-
2. 将源码中的插件目录直接拷贝到 fba 项目对应的目录下
11+
2. 拷贝插件代码
1212

1313
::: tabs
1414
@tab 后端
1515

16-
将插件源码 `backend/plugin/` 目录下的插件文件夹拷贝到 fba 项目 `backend/plugin/` 目录下
16+
将下载的源码直接拷贝到 `backend/plugin` 目录下
1717

1818
@tab 前端
1919

2020
暂无此计划...
2121
:::
2222

2323
3. 如果插件包含依赖(requirements.txt),执行 `backend/scripts/init_plugin.py` 文件安装依赖
24-
4. 根据插件使用说明(README.md)完成安装
24+
4. 根据插件说明(README.md)进行相关配置
25+
5. 重启服务
2526

26-
@tab 半自动
27+
@tab ZIP
2728

2829
1. 获取打包好的插件 zip 压缩包 <Badge type="warning" text="二选一" />
2930

30-
- 下载插件 GitHub 仓库为 zip 压缩包
31+
- 下载插件仓库为 zip 压缩包,例如 GitHub
3132

32-
::: details 示例
33-
![cg1](/images/plugin_zip.png)
34-
:::
33+
![zip](/images/plugin_zip.png)
3534

36-
- 通过 fba 插件打包接口创建的 zip 压缩包
35+
- 通过 fba 插件打包接口下载的 zip 压缩包
3736

38-
2. 将压缩包通过 fba 插件安装接口进行安装
39-
3. 根据插件使用说明(README.md)完成安装
37+
2. 将 zip 压缩包通过 zip 插件安装接口进行安装
38+
3. 根据插件说明(README.md)进行相关配置
39+
4. 重启服务
40+
41+
@tab GIT
42+
43+
1. 获取插件 git 仓库地址,理论上支持任何平台(GitHub、Gitlab、Gitee、Gitea...)
44+
2. 通过 git 插件安装接口进行安装
45+
3. 根据插件说明(README.md)进行相关配置
46+
4. 重启服务
4047

4148
::::
4249

docs/plugin/publish.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/plugin/share.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: 插件分享
3+
---
4+
5+
:::: steps
6+
7+
1. 创建个人插件仓库
8+
9+
使用插件模板仓库 [fba_plugin_template](https://github.com/fastapi-practices/fba_plugin_template)
10+
创建个人插件仓库,个人插件仓库命名请遵循以下规则:
11+
12+
`个人插件仓库名 == 插件名`
13+
14+
当我们创建个人插件仓库的时候,应将 `backend/plugin` 目录下的插件名作为仓库名使用,这样,插件将符合 fba 内置规则,并允许通过
15+
git 快捷安装
16+
17+
::: warning
18+
插件总是独一无二的,不允许安装同名插件,所以我们在对插件进行命名时,应尽量保持其独特性
19+
:::
20+
21+
![repo](/images/plugin_template.png)
22+
23+
2. 上传代码
24+
25+
将本地插件中的所有文件拷贝到个人插件仓库中
26+
27+
::: caution
28+
应拷贝插件目录下的所有文件,而不是直接拷贝插件目录
29+
:::
30+
31+
::::
32+
33+
## 公开
34+
35+
我们为插件创建了一个 [插件市场](market.md),用于展示和导航
36+
37+
如果您开发的插件与 fba 兼容,欢迎在 Discord
38+
社区的 [插件系统](https://discord.com/channels/1185035164577972344/1349951379560599572) 频道与我们分享
39+
40+
> [!IMPORTANT]
41+
> 发布插件必须满足以下要求:
42+
>
43+
> - 提供插件 GitHub 仓库地址
44+
> - 在插件仓库内提供至少一种您的(任意)联系方式用于技术支持

0 commit comments

Comments
 (0)