Skip to content

Commit d2e2740

Browse files
committed
fix rename --config-file to --config and --config to --inline-config in cm:stacks:migration
1 parent 68e8c5a commit d2e2740

4 files changed

Lines changed: 642 additions & 673 deletions

File tree

.talismanrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
fileignoreconfig:
22
- filename: pnpm-lock.yaml
3-
checksum: 24619b075664a197c8f648b04dd86ee79d653fbb583b33e4a3768f02378912ef
3+
checksum: b099fc2004034db2766c6ad0b49f284c0a16bbb6f251b95ae0bf29f53207876d
4+
- filename: packages/contentstack-migration/src/commands/cm/stacks/migration.ts
5+
checksum: ccce01ed8481a1e0b8551f36165f6eecb83b4f1c12ff5b114a291ea442540c57
6+
- filename: packages/contentstack-migration/README.md
7+
checksum: 921fb6a81f51b21609188bee4b6bb76e194109383b05d38c5d8b338124b16733
48
version: '1.0'

packages/contentstack-migration/README.md

Lines changed: 22 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# @contentstack/cli-migration
22

3-
The Contentstack CLI’s “Migration plugin allows developers to automate the content migration process and easily migrate your content from your system to Contentstack.
3+
The Contentstack CLI's "Migration" plugin allows developers to automate the content migration process and easily migrate your content from your system to Contentstack.
44

55
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
66
[![Version](https://img.shields.io/npm/v/@contentstack/cli-migration.svg)](https://npmjs.org/package/@contentstack/cli-migration)
77
[![Downloads/week](https://img.shields.io/npm/dw/@contentstack/cli-migration.svg)](https://npmjs.org/package/@contentstack/cli-migration)
8-
[![License](https://img.shields.io/npm/l/@contentstack/cli-migration.svg)](https://github.com/***REMOVED***/cli-migration/blob/master/package.json)
8+
[![License](https://img.shields.io/npm/l/@contentstack/cli-migration.svg)](https://github.com/contentstack/cli-plugins/blob/main/LICENSE)
99

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

3434
<!-- commands -->
35-
* [`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)
36-
* [`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)
35+
* [`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)
3736

38-
## `csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`
37+
## `csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [-c <value>] [--inline-config <value>] [--multiple]`
3938

4039
Contentstack migration script.
4140

4241
```
4342
USAGE
44-
$ csdx cm:migration cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>]
45-
[--config-file <value>] [--config <value>] [--multiple]
43+
$ csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>]
44+
[-c <value>] [--inline-config <value>] [--multiple]
4645
4746
FLAGS
48-
-a, --alias=<value> Use this flag to add the management token alias. You must use either the --alias flag or
49-
the --stack-api-key flag.
50-
-k, --stack-api-key=<value> Use this flag to add the API key of your stack. You must use either the --stack-api-key
51-
flag or the --alias flag.
52-
--branch=<value> Use this flag to add the branch name where you want to perform the migration. (target
53-
branch name)
54-
--config=<value>... [optional] Inline configuration, <key1>:<value1>. Passing an external configuration makes
55-
the script re-usable.
56-
--config-file=<value> [optional] Path of the JSON configuration file.
57-
--file-path=<value> Use this flag to provide the path of the file of the migration script.
58-
--multiple This flag helps you to migrate multiple content files in a single instance. Mention the
59-
folder path where your migration script files are stored.
47+
-a, --alias=<value> Use this flag to add the management token alias. You must use either the --alias flag or
48+
the --stack-api-key flag.
49+
-c, --config=<value> [optional] Path of the JSON configuration file.
50+
-k, --stack-api-key=<value> Use this flag to add the API key of your stack. You must use either the --stack-api-key
51+
flag or the --alias flag.
52+
--branch=<value> Use this flag to add the branch name where you want to perform the migration. (target
53+
branch name)
54+
--file-path=<value> Use this flag to provide the path of the file of the migration script.
55+
--inline-config=<value> [optional] Inline configuration, <key1>:<value1>. Use this to pass key-value pairs
56+
directly on the command line instead of a config file.
57+
--multiple This flag helps you to migrate multiple content files in a single instance. Mention the
58+
folder path where your migration script files are stored.
6059
6160
DESCRIPTION
6261
Contentstack migration script.
@@ -69,59 +68,16 @@ EXAMPLES
6968
7069
$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>
7170
72-
$ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>
71+
$ csdx cm:migration --inline-config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>
7372
74-
$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>
73+
$ csdx cm:migration --config <path/to/json/config/file> --file-path <migration/script/file/path>
7574
76-
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
75+
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
7776
7877
$ csdx cm:migration --alias <management-token-alias> --file-path <migration/script/file/path>
7978
```
8079

81-
## `csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`
82-
83-
Contentstack migration script.
84-
85-
```
86-
USAGE
87-
$ csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>]
88-
[--config <value>] [--multiple]
89-
90-
FLAGS
91-
-a, --alias=<value> Use this flag to add the management token alias. You must use either the --alias flag or
92-
the --stack-api-key flag.
93-
-k, --stack-api-key=<value> Use this flag to add the API key of your stack. You must use either the --stack-api-key
94-
flag or the --alias flag.
95-
--branch=<value> Use this flag to add the branch name where you want to perform the migration. (target
96-
branch name)
97-
--config=<value>... [optional] Inline configuration, <key1>:<value1>. Passing an external configuration makes
98-
the script re-usable.
99-
--config-file=<value> [optional] Path of the JSON configuration file.
100-
--file-path=<value> Use this flag to provide the path of the file of the migration script.
101-
--multiple This flag helps you to migrate multiple content files in a single instance. Mention the
102-
folder path where your migration script files are stored.
103-
104-
DESCRIPTION
105-
Contentstack migration script.
106-
107-
ALIASES
108-
$ csdx cm:migration
109-
110-
EXAMPLES
111-
$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key>
112-
113-
$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>
114-
115-
$ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>
116-
117-
$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>
118-
119-
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
120-
121-
$ csdx cm:migration --alias <management-token-alias> --file-path <migration/script/file/path>
122-
```
123-
124-
_See code: [src/commands/cm/stacks/migration.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-migration/src/commands/cm/stacks/migration.ts)_
80+
_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)_
12581
<!-- commandsstop -->
12682

12783
### Points to remember

packages/contentstack-migration/src/commands/cm/stacks/migration.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ export default class MigrationCommand extends Command {
4343
static examples: string[] = [
4444
'$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key>',
4545
'$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>',
46-
'$ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>',
47-
'$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>',
46+
'$ csdx cm:migration --inline-config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>',
47+
'$ csdx cm:migration --config <path/to/json/config/file> --file-path <migration/script/file/path>',
4848
'$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path> ',
4949
'$ csdx cm:migration --alias <management-token-alias> --file-path <migration/script/file/path>',
5050
];
@@ -67,10 +67,11 @@ export default class MigrationCommand extends Command {
6767
branch: flags.string({
6868
description: 'Use this flag to add the branch name where you want to perform the migration. (target branch name)',
6969
}),
70-
'config-file': flags.string({
70+
config: flags.string({
71+
char: 'c',
7172
description: '[optional] Path of the JSON configuration file.',
7273
}),
73-
config: flags.string({
74+
'inline-config': flags.string({
7475
description:
7576
'[optional] Inline configuration, <key1>:<value1>. Passing an external configuration makes the script re-usable.',
7677
multiple: true,
@@ -113,7 +114,7 @@ export default class MigrationCommand extends Command {
113114
static aliases: string[] = ['cm:migration'];
114115

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

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

129130
if (!authtoken && !alias) {
130131
this.log(
@@ -141,8 +142,8 @@ export default class MigrationCommand extends Command {
141142
// Reset map instance
142143
const mapInstance = getMapInstance();
143144
resetMapInstance(mapInstance);
144-
if (migrationCommandFlags['config-file']) {
145-
set('config-path', mapInstance, migrationCommandFlags['config-file']);
145+
if (migrationCommandFlags['config']) {
146+
set('config-path', mapInstance, migrationCommandFlags['config']);
146147
}
147148

148149
if (Array.isArray(config) && config.length > 0) {

0 commit comments

Comments
 (0)