Migration Mechanism一个例子:每个 migration script 都有一系列属性。
name
格式如下:migration-v--.
version: migration 的目标版本。
migration-feature-name: 描述 Migration 的具体内容。
sequence-number:脚本执行顺序。
其中 version 属性至关重要:version is very important for the Angular update mechanism. It is used to automatically run the required migration scripts for a specific version.
用来自动运行所需的 Migration 脚本。
factory: 指向真正的 Migration 脚本。Check whether any of the changed files are exported in the public API. If no, then no further action is required.
检查被修改的文件是否被导出为 public API,如果否,什么都不用做。
Check whether any of the changes you have made are breaking changes. If not, no further action is required.
如果做的修改不包含 breaking changes,什么都不用做。
如果是 breaking change,需要将修改记录到对应的 Migration 文件里,比如:docs/migration/3_0.md.
Build automation tasks, as described in the Validations, Constructor Deprecation, and Component Deprecation) sections, above.
构建自动化任务。
Test the added migrations by running tests, trying to migrate an example app, and so on.
可以通过运行测试的方式,测试新建的 Migration.
可以参考这个 pull request:https://github.com/SAP/spartacus/pull/9946/files