@contentstack/cli-migration

中文文档
2.0.2发布于 2026/10/06MIT近 30 天下载 4.4万

The Contentstack CLI's "Migration" plugin allows developers to automate the content migration process and easily migrate your content from your system to Contentstack.

原始使用文档

@contentstack/cli-migration

The Contentstack CLI's "Migration" plugin allows developers to automate the content migration process and easily migrate your content from your system to Contentstack.

oclif Version Downloads/week License

Usage

$ 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
...

Commands

csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [-c <value>] [--inline-config <value>] [--multiple]

Contentstack migration script.

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>

See code: src/commands/cm/stacks/migration.ts

Points to remember

  • Currently, you can pass a custom schema to the createField method to migrate group fields.
  • You can migrate global fields by creating an SDK instance and adding it to content types using the createField method.
  • Currently, you can migrate entries by creating an SDK instance to create/update/delete entries for your content type.

版本与发布记录

@contentstack/cli-migration 共发布 88 个版本,首次发布于 2022/02/25;过去 12 个月发布了 37 个版本。

版本发布日期距今
2.0.2latest2026/10/061 个月前
1.12.8v1-x2026/10/061 个月前
2.0.12026/09/151 个月前
1.12.72026/08/132 个月前
2.0.02026/08/122 个月前
1.12.62026/08/053 个月前

其他发布通道:beta → 2.0.0-beta.17,v1-x → 1.12.8。

关于 @contentstack/cli-migration 的常见问题

@contentstack/cli-migration 是什么?

The Contentstack CLI's "Migration" plugin allows developers to automate the content migration process and easily migrate your content from your system to Contentstack.

如何安装 @contentstack/cli-migration?

在项目目录运行 npm install @contentstack/cli-migration,或使用 pnpm add / yarn add / bun add。

@contentstack/cli-migration 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/contentstack__cli-migration 是否存在。

@contentstack/cli-migration 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@contentstack/cli-migration 可以商用吗?

@contentstack/cli-migration 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@contentstack/cli-migration 的下载量有多少?

根据 npm 官方下载统计,@contentstack/cli-migration 在 2026/10/11 – 2026/11/09 这 30 天内被下载 44,163 次,日均约 1,472 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@contentstack/cli-migration 还在维护吗?

最新版本 2.0.2 发布于 2026/10/06(1 个月前);至今共发布 88 个版本,其中过去 12 个月发布了 37 个;首次发布于 2022/02/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。