@contentstack/cli-cm-export

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

Contentstack CLI plugin to export content from stack

原始使用文档

@contentstack/cli-cm-export

It is Contentstack’s CLI plugin to export content from the stack. To learn how to export and import content in Contentstack, refer to the Migration guide.

License

Use csdx config:set:region to set your region. Run csdx config:set:region --help for available regions.

Usage

$ npm install -g @contentstack/cli-cm-export
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-export/2.0.2 linux-x64 node-v22.23.3
$ csdx --help [COMMAND]
USAGE
  $ csdx COMMAND
...

Commands

csdx cm:stacks:export [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]

Export content from a stack

USAGE
  $ csdx cm:stacks:export [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>]
    [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]

FLAGS
  -a, --alias=<value>
      The management token alias of the source stack from which you will export content.

  -c, --config=<value>
      [optional] Path of the config

  -d, --data-dir=<value>
      The path or the location in your file system to store the exported content. For e.g., ./content

  -k, --stack-api-key=<value>
      API Key of the source stack

  -y, --yes
      [optional] Force override all Marketplace prompts.

  --branch=<value>
      [optional] The name of the branch where you want to export your content. If you don't mention the branch name, then
      by default the content will be exported from all the branches of your stack.

  --branch-alias=<value>
      (Optional) The alias of the branch from which you want to export content.

  --content-types=<value>...
      [optional]  The UID of the content type(s) whose content you want to export. In case of multiple content types,
      specify the IDs separated by spaces.

  --module=<option>
      [optional] Specific module name. If not specified, the export command will export all the modules from the stack.
      The available modules are stack, assets, locales, environments, extensions, webhooks, global-fields, entries,
      content-types, custom-roles, workflows, publishing-rules, labels, marketplace-apps, taxonomies, personalize, and
      composable-studio.
      <options: stack|assets|locales|environments|extensions|webhooks|global-fields|entries|content-types|custom-roles|wor
      kflows|publishing-rules|labels|marketplace-apps|taxonomies|personalize|composable-studio>

  --secured-assets
      [optional] Use this flag for assets that are secured.

DESCRIPTION
  Export content from a stack

EXAMPLES
  $ csdx cm:stacks:export --stack-api-key <stack_api_key> --data-dir <path/of/export/destination/dir>

  $ csdx cm:stacks:export --config <path/to/config/dir>

  $ csdx cm:stacks:export --alias <management_token_alias>

  $ csdx cm:stacks:export --alias <management_token_alias> --data-dir <path/to/export/destination/dir>

  $ csdx cm:stacks:export --alias <management_token_alias> --config <path/to/config/file>

  $ csdx cm:stacks:export --module <single module name>

  $ csdx cm:stacks:export --branch [optional] branch name

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

版本与发布记录

@contentstack/cli-cm-export 共发布 129 个版本,首次发布于 2020/10/15;过去 12 个月发布了 48 个版本。

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

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

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

@contentstack/cli-cm-export 是什么?

Contentstack CLI plugin to export content from stack

如何安装 @contentstack/cli-cm-export?

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

@contentstack/cli-cm-export 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@contentstack/cli-cm-export 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

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

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

@contentstack/cli-cm-export 可以商用吗?

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

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

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

@contentstack/cli-cm-export 还在维护吗?

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