v4 插件迁移指南
¥v4 plugin migration guide
本指南的目标是通过解决重大更改来启动 v3 插件并在 v4 上运行。
¥The goal of this guide is to get a v3 plugin up and running on v4 by resolving breaking changes.
本指南并不是 v4 插件 API 的详尽资源,这些 API 在 服务器 API 和 管理面板 API 文档中进行了描述。
¥This guide is not an exhaustive resource for the v4 plugin APIs, which are described in the Server API and Admin Panel API documentations.
将插件从 Strapi v3.6.x 迁移到 v4.0.x 包括以下步骤:
¥Migrating a plugin from Strapi v3.6.x to v4.0.x consists in the following steps:
可选,如果插件与 Strapi 的后端交互,则为 迁移后端代码,
¥optionally, migrating the back-end code if the plugin interacts with Strapi's back end,
可选,如果插件与管理面板交互,则为 迁移前端代码,
¥optionally, migrating the front-end code if the plugin interacts with the admin panel,
和 启用插件。
¥and enabling the plugin.
根据这些步骤,某些操作只能手动完成,而其他操作则可以通过修改代码的脚本(称为 codemod)自动执行。下表列出了迁移每个步骤的可用选项:
¥Depending on these steps, some actions can only be done manually while others can be performed automatically by scripts that modify the code, which are called codemods. The following table lists available options for each step of the migration:
行动 | 迁移类型 |
---|---|
更新文件夹结构 | Automatic 或 manual |
迁移插件后端 | 半自动 |
迁移插件前端 | 手动的 |
启用插件 | 手动的 |
如果你对代码模组有任何问题或想为该项目做出贡献,请 创建一个问题 或 打开拉取请求。
¥If you have any issues with the codemods or would like to contribute to the project please create an issue or open a pull request.