Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: 0feb3713a8f2e4a8a1f5f528218c2c578265dc5b31ff283a283fefc949bbafd2
version: ""
checksum: 0b457537758c783fd47916e9b51175f62b1c58dd691e7bda29d687be65bcdbe6
version: ""
88 changes: 22 additions & 66 deletions packages/contentstack-migration/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# @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.
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](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/@contentstack/cli-migration.svg)](https://npmjs.org/package/@contentstack/cli-migration)
[![Downloads/week](https://img.shields.io/npm/dw/@contentstack/cli-migration.svg)](https://npmjs.org/package/@contentstack/cli-migration)
[![License](https://img.shields.io/npm/l/@contentstack/cli-migration.svg)](https://github.com/***REMOVED***/cli-migration/blob/master/package.json)
[![License](https://img.shields.io/npm/l/@contentstack/cli-migration.svg)](https://github.com/contentstack/cli-plugins/blob/main/LICENSE)

<!-- toc -->
* [@contentstack/cli-migration](#contentstackcli-migration)
Expand All @@ -32,31 +32,30 @@ USAGE
# Commands

<!-- commands -->
* [`csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`](#csdx-cmstacksmigration--k-value--a-value---file-path-value---branch-value---config-file-value---config-value---multiple)
* [`csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`](#csdx-cmstacksmigration--k-value--a-value---file-path-value---branch-value---config-file-value---config-value---multiple)
* [`csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [-c <value>] [--inline-config <value>] [--multiple]`](#csdx-cmstacksmigration--k-value--a-value---file-path-value---branch-value--c-value---inline-config-value---multiple)

## `csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`
## `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:migration cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>]
[--config-file <value>] [--config <value>] [--multiple]
$ 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.
-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)
--config=<value>... [optional] Inline configuration, <key1>:<value1>. Passing an external configuration makes
the script re-usable.
--config-file=<value> [optional] Path of the JSON configuration file.
--file-path=<value> Use this flag to provide the path of the file of the migration script.
--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.
-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>. Use this to pass key-value pairs
directly on the command line instead of a config file.
--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.
Expand All @@ -69,59 +68,16 @@ EXAMPLES

$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>

$ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>
$ csdx cm:migration --inline-config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>

$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>
$ csdx cm:migration --config <path/to/json/config/file> --file-path <migration/script/file/path>

$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>

$ csdx cm:migration --alias <management-token-alias> --file-path <migration/script/file/path>
```

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

Contentstack migration script.

```
USAGE
$ csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>]
[--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.
-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)
--config=<value>... [optional] Inline configuration, <key1>:<value1>. Passing an external configuration makes
the script re-usable.
--config-file=<value> [optional] Path of the JSON configuration file.
--file-path=<value> Use this flag to provide the path of the file of the migration script.
--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.

ALIASES
$ csdx cm:migration

EXAMPLES
$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key>

$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>

$ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>

$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>

$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>

$ csdx cm:migration --alias <management-token-alias> --file-path <migration/script/file/path>
```

_See code: [src/commands/cm/stacks/migration.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-migration/src/commands/cm/stacks/migration.ts)_
_See code: [src/commands/cm/stacks/migration.ts](https://github.com/contentstack/cli-plugins/blob/main/packages/contentstack-migration/src/commands/cm/stacks/migration.ts)_
<!-- commandsstop -->

### Points to remember
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export default class MigrationCommand extends Command {
static examples: string[] = [
'$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key>',
'$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>',
'$ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>',
'$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>',
'$ 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:migration --multiple --file-path <migration/scripts/dir/path> ',
'$ csdx cm:migration --alias <management-token-alias> --file-path <migration/script/file/path>',
];
Expand All @@ -67,10 +67,11 @@ export default class MigrationCommand extends Command {
branch: flags.string({
description: 'Use this flag to add the branch name where you want to perform the migration. (target branch name)',
}),
'config-file': flags.string({
config: flags.string({
char: 'c',
description: '[optional] Path of the JSON configuration file.',
}),
config: flags.string({
'inline-config': flags.string({
description:
'[optional] Inline configuration, <key1>:<value1>. Passing an external configuration makes the script re-usable.',
multiple: true,
Expand Down Expand Up @@ -113,7 +114,7 @@ export default class MigrationCommand extends Command {
static aliases: string[] = ['cm:migration'];

static usage: string =
'cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]';
'cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [-c <value>] [--inline-config <value>] [--multiple]';

async run(): Promise<void> {
// TODO: filePath validation required.
Expand All @@ -124,7 +125,7 @@ export default class MigrationCommand extends Command {
const authtoken = isAuthenticated();
const apiKey = (migrationCommandFlags as any)['api-key'] || (migrationCommandFlags as any)['stack-api-key'];
const alias = (migrationCommandFlags as any)['alias'] || (migrationCommandFlags as any)['management-token-alias'];
const config = (migrationCommandFlags as any)['config'];
const config = (migrationCommandFlags as any)['inline-config'];

if (!authtoken && !alias) {
this.log(
Expand All @@ -141,8 +142,8 @@ export default class MigrationCommand extends Command {
// Reset map instance
const mapInstance = getMapInstance();
resetMapInstance(mapInstance);
if (migrationCommandFlags['config-file']) {
set('config-path', mapInstance, migrationCommandFlags['config-file']);
if (migrationCommandFlags['config']) {
set('config-path', mapInstance, migrationCommandFlags['config']);
}

if (Array.isArray(config) && config.length > 0) {
Expand Down
Loading
Loading