@contentstack/cli-migration (英语)
内容tack CLI的"迁移"插件允许开发者实现内容迁移过程的自动化,并方便地将您的内容从您的系统迁移到内容tack.
使用量
$ npm install -g @contentstack/cli-migration
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-migration/2.0.2 linux-x64 node-v22.23.3
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
...
图标
csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [-c <value>] [--inline-config <value>] [--multiple]
内容tack 迁移脚本.
USAGE
$ csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [-c <value>]
[--inline-config <value>] [--multiple]
FLAGS
-a, --alias=<value> Use this flag to add the management token alias. You must use either the --alias flag
or the --stack-api-key flag.
-c, --config=<value> [optional] Path of the JSON configuration file.
-k, --stack-api-key=<value> Use this flag to add the API key of your stack. You must use either the
--stack-api-key flag or the --alias flag.
--branch=<value> Use this flag to add the branch name where you want to perform the migration. (target
branch name)
--file-path=<value> Use this flag to provide the path of the file of the migration script.
--inline-config=<value>... [optional] Inline configuration, <key1>:<value1>. Passing an external configuration
makes the script re-usable.
--multiple This flag helps you to migrate multiple content files in a single instance. Mention
the folder path where your migration script files are stored.
DESCRIPTION
Contentstack migration script.
EXAMPLES
$ csdx cm:stacks:migration --file-path <migration/script/file/path> -k <api-key>
$ csdx cm:stacks:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>
$ csdx cm:migration --inline-config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>
$ csdx cm:migration --config <path/to/json/config/file> --file-path <migration/script/file/path>
$ csdx cm:stacks:migration --multiple --file-path <migration/scripts/dir/path>
$ csdx cm:stacks:migration --alias <management-token-alias> --file-path <migration/script/file/path>
参见代码 : src/commands/cm/stacks/migration.ts 互联网档案馆的存檔,存档日期2013-12-02
要记住的点
- 目前,您可以将自定义的策略传递到创建的 Field 方法来迁移组字段 .
- 您可以通过创建 SDK 实例来迁移全局字段, 并使用创建字段方法将其添加到内容类型中 .
- 目前,您可以通过创建 SDK 实例来迁移条目,为您的内容类型创建/更新/删除条目 .