@contentstack/cli-cm-import

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

Contentstack CLI plugin to import content into stack

原始使用文档

@contentstack/cli-cm-import

It is Contentstack’s CLI plugin to import content in 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-import
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-import/2.0.2 linux-x64 node-v22.23.3
$ csdx --help [COMMAND]
USAGE
  $ csdx COMMAND
...

Commands

csdx cm:stacks:import [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]

Import content from a stack

USAGE
  $ csdx cm:stacks:import [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>]
    [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]

FLAGS
  -a, --alias=<value>
      The management token of the destination stack where you will import the content.

  -c, --config=<value>
      [optional] The path of the configuration JSON file containing all the options for a single run.

  -d, --data-dir=<value>
      The path or the location in your file system where the content, you intend to import, is stored. For example, -d
      "C:\Users\Name\Desktop\cli\content". If the export folder has branches involved, then the path should point till the
      particular branch. For example, “-d "C:\Users\Name\Desktop\cli\content\branch_name"

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

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

  --backup-dir=<value>
      [optional] Backup directory name when using specific module.

  --branch=<value>
      The name of the branch where you want to import your content. If you don't mention the branch name, then by default
      the content will be imported to the main branch.

  --branch-alias=<value>
      Specify the branch alias where you want to import your content. If not specified, the content is imported into the
      main branch by default.

  --exclude-global-modules
      Excludes the branch-independent module from the import operation.

  --import-webhook-status=<option>
      [default: disable] [default: disable] (optional) This webhook state keeps the same state of webhooks as the source
      stack. <options: disable|current>
      <options: disable|current>

  --module=<option>
      [optional] Specify the module to import into the target stack. If not specified, the import command will import all
      the modules into 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, variant-entries, 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|variant-entries|composable-studio>

  --personalize-project-name=<value>
      (optional) Provide a unique name for the Personalize project.

  --replace-existing
      Replaces the existing module in the target stack.

  --skip-assets-publish
      Skips asset publishing during the import process.

  --skip-audit
      Skips the audit fix that occurs during an import operation.

  --skip-entries-publish
      Skips entry publishing during the import process

  --skip-existing
      Skips the module exists warning messages.

  --skip-taxonomy-publish
      Skips taxonomy publishing during the import process.

DESCRIPTION
  Import content from a stack

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

  $ csdx cm:stacks:import --config <path/of/config/dir>

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

  $ csdx cm:stacks:import --module <single module name> --backup-dir <backup dir>

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

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

  $ csdx cm:stacks:import --alias <management_token_alias> --config <path/of/config/file>

  $ csdx cm:stacks:import --branch <branch name>  --yes --skip-audit

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

版本与发布记录

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

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

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

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

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

Contentstack CLI plugin to import content into stack

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

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

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

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

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

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

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

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

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

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

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

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

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

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