Skip to content
Merged
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
12 changes: 2 additions & 10 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
fileignoreconfig:

- filename: pnpm-lock.yaml
checksum: 649aae748e3ae8c157439dc6c7c9ea402cc19b4dab7ca64b7e4d839d1375df53
- filename: packages/contentstack-audit/src/audit-base-command.ts
checksum: b706ea114a3cb5e4c0e7e163f32ceffa3356a6b0766bf5b8fe387c3c72f44c36
- filename: packages/contentstack-audit/src/types/content-types.ts
checksum: d16a65415c3184f15a807d58e5858310aeb5633794fc9075e36f89c94da636c3
- filename: packages/contentstack-audit/src/modules/entries.ts
checksum: 13072df0872f8c098d23f49b02f9e8f3e492ab2f483d67a5ea5e423ab406ad94
- filename: packages/contentstack-audit/test/unit/modules/entries.test.ts
checksum: 31d9767d87e4e9db54f641e8cb9d3360f591acdaa8b089a83eaa4aacdf0c3a35
version: '1.0'
checksum: 0b457537758c783fd47916e9b51175f62b1c58dd691e7bda29d687be65bcdbe6
version: ""
86 changes: 21 additions & 65 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/contentstack/cli-plugins/blob/main/packages/contentstack-migration/LICENSE)
[![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,54 +68,11 @@ 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 --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 --multiple --file-path <migration/scripts/dir/path>

$ csdx cm:migration --alias <management-token-alias> --file-path <migration/script/file/path>
```
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: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:stacks:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>',
'$ csdx cm:stacks: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:stacks:migration --multiple --file-path <migration/scripts/dir/path> ',
'$ csdx cm:stacks: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 All @@ -84,7 +85,7 @@ export default class MigrationCommand extends Command {
static aliases: string[] = [];

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 @@ -95,7 +96,7 @@ export default class MigrationCommand extends Command {
const authtoken = isAuthenticated();
const apiKey = (migrationCommandFlags as any)['stack-api-key'];
const alias = (migrationCommandFlags as any)['alias'];
const config = (migrationCommandFlags as any)['config'];
const config = (migrationCommandFlags as any)['inline-config'];

if (!authtoken && !alias) {
this.log(
Expand All @@ -112,8 +113,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