# @contentstack/cli-cm-export 中文文档

规范地址：https://npmcn.com/package/%40contentstack/cli-cm-export/

版本：2\.0\.2
npm 元数据更新时间：2026-10-06T14:50:16.560Z
中文译文更新时间：2026-11-10T16:47:13.885Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40contentstack/cli-cm-export
原文对照：https://npmcn.com/package/%40contentstack/cli-cm-export/?lang=original
项目主页：https://github.com/contentstack/cli
源码仓库：https://github.com/contentstack/cli-plugins

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：357 kB，91 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=22\.0\.0
- 运行依赖：16 个
- 首次发布：2020-10-15T07:46:38.242Z
- 最新版本发布：2026-10-06T14:50:15.539Z
- 近 30 天下载量：44848（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：129（近 12 个月 48 个）

## 中文简介

从堆栈导出内容的内存 CLI 插件

## 安装

```sh
npm install @contentstack/cli-cm-export
```

也可以使用：`pnpm add @contentstack/cli-cm-export`、`yarn add @contentstack/cli-cm-export`、`bun add @contentstack/cli-cm-export`

## README

# @contentstack/cli-cm-export

从堆栈中导出内容是Mineltack的 CLI 插件 。 为了了解如何在Contack中出口和进口内容,请参考 [移徙指南](https://www.contentstack.com/docs/headless-cms/cli/migration/)。 。 。 .

[![License](https://img.shields.io/npm/l/@contentstack/cli)](https://github.com/contentstack/cli/blob/main/LICENSE)

-   [@contentstack/cli-cm-export](https://npmcn.com/package/%40contentstack/cli-cm-export/#readme-contentstackcli-cm-export)
-   [使用量](https://npmcn.com/package/%40contentstack/cli-cm-export/#readme-usage)
-   [图标](https://npmcn.com/package/%40contentstack/cli-cm-export/#readme-commands)

使用 `csdx config:set:region` 设置您的区域。 运行 `csdx config:set:region --help` 用于现有区域.

# 使用量

```sh-session
$ 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
...
```

# 图标

-   [`csdx cm:stacks:export [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]`](https://npmcn.com/package/%40contentstack/cli-cm-export/#readme-csdx-cmstacksexport---config-value---stack-api-key-value---data-dir-value---alias-value---module-value---content-types-value---branch-value---secured-assets)

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

从堆栈导出内容

```
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
```

_参见代码 : [src/commands/cm/stacks/export.ts (中文(简体) )](https://github.com/contentstack/cli-plugins/blob/main/packages/contentstack-export/src/commands/cm/stacks/export.ts)_

## 常见问题

### @contentstack/cli-cm-export 是什么？

从堆栈导出内容的内存 CLI 插件

### 如何安装 @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 和提交记录判断。

