Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: 完成发布插件教程 #2078

Merged
merged 14 commits into from
Jun 11, 2023
14 changes: 7 additions & 7 deletions website/docs/developer/plugin-publishing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ NoneBot2 插件使用下述命名规范:

本段指导填写插件依赖,避免不正确的依赖信息导致插件无法正常工作。

依赖填写的基本原则:程序直接导入了什么第三方库,就写什么第三方包;能用哪些第三方库的特性,就根据使用的特性锁定第三方包版本。
依赖填写的基本原则:程序直接导入了什么第三方库,就添加什么第三方包依赖;能用哪些第三方库的特性,就根据使用的特性锁定第三方包版本。

根据上述原则可以得到以下几点:

1. 插件必须填写 `nonebot2` 依赖,如果只打算支持正式版请锁定到 `>=2.0.0`,否则应使用预览版本号进行锁定;
2. 插件必须使用的适配器也要写入依赖列表,如使用 OneBot 适配器的插件应填写 `nonebot-adapter-onebot` 依赖;
3. `nonebot` 是 NoneBot1 的包,注意与 `nonebot2` 区分,**不要**写入插件的依赖列表;
:::warning 注意
1. 插件建议添加 `nonebot2` 依赖以避免“幽灵依赖”,如果只打算支持正式版请锁定到 `>=2.0.0`,否则应使用预览版本号进行锁定;
2. 插件必须使用的适配器也要加入依赖列表,如使用 OneBot 适配器的插件应添加 `nonebot-adapter-onebot` 依赖;
3. 由于 `nonebot` 是指 `nonebot1` **而非** `nonebot2`,因此要注意**不要**将 `nonebot1` 添加为插件的依赖,以免造成冲突;
NCBM marked this conversation as resolved.
Show resolved Hide resolved
4. 尽可能避免使用 `==` 锁定单一版本,增强与其它插件的兼容性。
:::

### 填写 PluginMetadata(插件元数据)
NCBM marked this conversation as resolved.
Show resolved Hide resolved

目前版本的插件要求必须填写必要元数据才允许发布。
NCBM marked this conversation as resolved.
Show resolved Hide resolved

:::tip 提示
[NoneBot2 2.0.0 正式版](https://github.com/nonebot/nonebot2/releases/tag/v2.0.0)起新增了 `type` `homepage`
[NoneBot2 2.0.0 正式版](https://github.com/nonebot/nonebot2/releases/tag/v2.0.0)起新增了 `type`, `homepage`,
`supported_adapters` 这几个插件元数据字段(**不**向前兼容),如需兼容以前的开发版本请自行在插件内检查版本号。
:::

Expand Down