升级工具
¥Upgrade tool
升级工具帮助 Strapi 用户将其 Strapi 应用依赖和代码升级到特定版本。
¥The upgrade tool assists Strapi users in upgrading their Strapi application dependencies and code to a specific version.
运行升级工具会触发应用依赖的更新、它们的安装以及一系列代码修改 的执行,这些代码修改会根据目标版本之前引入的重大更改自动编辑应用代码库。
¥Running the upgrade tool triggers the update of the application dependencies, their installation, and the execution of a series of codemods that automatically edit the application codebase according to the breaking changes introduced up until the targeted version.
升级工具是一个 Strapi 包,可以从 CLI 运行。
¥The upgrade tool is a Strapi package and can be run from the CLI.
范围
¥Scope
虽然升级工具有助于升级应用和插件,但它并未涵盖其各个方面。
¥While the upgrade tool helps upgrade applications and plugins, it doesn't cover every aspect of it.
✅升级工具支持:
¥✅ The upgrade tool supports:
-
更新项目的依赖
¥Updating the project's dependencies
-
将自动代码转换应用于现有文件
¥Applying automatic code transformation to existing files
-
为项目安装或重新安装正确的依赖
¥Installing or re-installing the correct dependencies for the project
❌升级工具不支持:
¥❌ The upgrade tool doesn't support:
-
通过添加、删除或移动文件和目录来修改文件树
¥Modifying the file tree by adding, removing or moving files and directories
-
迁移应用的数据。这由 Strapi 数据库迁移处理
¥Migrating the application's data. This is handled by Strapi database migrations
升级工具完成执行后,强烈建议在重新运行应用或插件之前检查所做的修改。
¥After the upgrade tool completes its execution, it is strongly recommended to review the modifications made before re-running the app or plugin.
版本类型
¥Version types
Strapi 版本号遵守 语义版本控制 约定:
¥Strapi version numbers respect the semantic versioning conventions:


-
第一个数字是主版本号。
¥The first number is the major version number.
-
第二个数字是次要版本号。
¥The second number is the minor version number.
-
第三个数字是补丁版本号。
¥The third number is the patch version number.
升级工具允许升级到主要版本、次要版本或补丁版本。
¥The upgrade tool allows upgrading to a major, minor, or patch version.
升级工具的作用取决于最新的现有版本和你运行的命令。
¥What the upgrade tool does depends on the latest existing version and the command you run.
例如,如果最新的 Strapi v4 版本是 v4.25.9:
¥For instance, if the latest Strapi v4 version is v4.25.9: