@contentstack/cli-migration 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -14
- package/oclif.manifest.json +135 -1
- package/package.json +11 -15
- package/src/commands/cm/stacks/migration.js +2 -2
package/README.md
CHANGED
|
@@ -20,8 +20,8 @@ The Contentstack CLI’s “Migration” plugin allows developers to automate th
|
|
|
20
20
|
$ npm install -g @contentstack/cli-migration
|
|
21
21
|
$ csdx COMMAND
|
|
22
22
|
running command...
|
|
23
|
-
$ csdx (
|
|
24
|
-
@contentstack/cli-migration/1.0
|
|
23
|
+
$ csdx (--version)
|
|
24
|
+
@contentstack/cli-migration/1.1.0 linux-x64 node-v16.19.0
|
|
25
25
|
$ csdx --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ csdx COMMAND
|
|
@@ -33,6 +33,7 @@ USAGE
|
|
|
33
33
|
|
|
34
34
|
<!-- commands -->
|
|
35
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-1)
|
|
36
37
|
|
|
37
38
|
## `csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`
|
|
38
39
|
|
|
@@ -40,34 +41,79 @@ Contentstack migration script.
|
|
|
40
41
|
|
|
41
42
|
```
|
|
42
43
|
USAGE
|
|
43
|
-
$ csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>]
|
|
44
|
-
|
|
44
|
+
$ csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>]
|
|
45
|
+
[--config <value>] [--multiple]
|
|
46
|
+
|
|
47
|
+
FLAGS
|
|
48
|
+
-B, --branch=<value> Use this flag to add the branch name where you want to perform the migration.
|
|
49
|
+
-a, --alias=<value> Use this flag to add the management token alias.
|
|
50
|
+
-k, --stack-api-key=<value> With this flag add the API key of your stack.
|
|
51
|
+
--config=<value>... [optional] inline configuration, <key1>:<value1>
|
|
52
|
+
--config-file=<value> [optional] Path of the JSON configuration file
|
|
53
|
+
--file-path=<value> Use this flag to provide the path of the file of the migration script provided by the
|
|
54
|
+
user.
|
|
55
|
+
--multiple This flag helps you to migrate multiple content files in a single instance.
|
|
56
|
+
|
|
57
|
+
DESCRIPTION
|
|
58
|
+
Contentstack migration script.
|
|
45
59
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
--
|
|
51
|
-
|
|
60
|
+
ALIASES
|
|
61
|
+
$ csdx cm:migration
|
|
62
|
+
|
|
63
|
+
EXAMPLES
|
|
64
|
+
$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key>
|
|
65
|
+
|
|
66
|
+
$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>
|
|
67
|
+
|
|
68
|
+
$ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>
|
|
69
|
+
|
|
70
|
+
$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>
|
|
71
|
+
|
|
72
|
+
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
|
|
52
73
|
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
$ csdx cm:migration --alias --file-path <migration/script/file/path> -k <api-key>
|
|
75
|
+
```
|
|
55
76
|
|
|
56
|
-
|
|
77
|
+
## `csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`
|
|
78
|
+
|
|
79
|
+
Contentstack migration script.
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
USAGE
|
|
83
|
+
$ csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>]
|
|
84
|
+
[--config <value>] [--multiple]
|
|
85
|
+
|
|
86
|
+
FLAGS
|
|
87
|
+
-B, --branch=<value> Use this flag to add the branch name where you want to perform the migration.
|
|
88
|
+
-a, --alias=<value> Use this flag to add the management token alias.
|
|
89
|
+
-k, --stack-api-key=<value> With this flag add the API key of your stack.
|
|
90
|
+
--config=<value>... [optional] inline configuration, <key1>:<value1>
|
|
91
|
+
--config-file=<value> [optional] Path of the JSON configuration file
|
|
92
|
+
--file-path=<value> Use this flag to provide the path of the file of the migration script provided by the
|
|
93
|
+
user.
|
|
94
|
+
--multiple This flag helps you to migrate multiple content files in a single instance.
|
|
95
|
+
|
|
96
|
+
DESCRIPTION
|
|
97
|
+
Contentstack migration script.
|
|
57
98
|
|
|
58
99
|
ALIASES
|
|
59
100
|
$ csdx cm:migration
|
|
60
101
|
|
|
61
102
|
EXAMPLES
|
|
62
103
|
$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key>
|
|
104
|
+
|
|
63
105
|
$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>
|
|
106
|
+
|
|
64
107
|
$ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>
|
|
108
|
+
|
|
65
109
|
$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>
|
|
110
|
+
|
|
66
111
|
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
|
|
112
|
+
|
|
67
113
|
$ csdx cm:migration --alias --file-path <migration/script/file/path> -k <api-key>
|
|
68
114
|
```
|
|
69
115
|
|
|
70
|
-
_See code: [src/commands/cm/stacks/migration.js](https://github.com/contentstack/cli
|
|
116
|
+
_See code: [src/commands/cm/stacks/migration.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-migration/src/commands/cm/stacks/migration.js)_
|
|
71
117
|
<!-- commandsstop -->
|
|
72
118
|
|
|
73
119
|
### Points to remember
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1,135 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": "1.1.0",
|
|
3
|
+
"commands": {
|
|
4
|
+
"cm:stacks:migration": {
|
|
5
|
+
"id": "cm:stacks:migration",
|
|
6
|
+
"description": "Contentstack migration script.",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"usage": "cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]",
|
|
9
|
+
"pluginName": "@contentstack/cli-migration",
|
|
10
|
+
"pluginAlias": "@contentstack/cli-migration",
|
|
11
|
+
"pluginType": "core",
|
|
12
|
+
"aliases": [
|
|
13
|
+
"cm:migration"
|
|
14
|
+
],
|
|
15
|
+
"examples": [
|
|
16
|
+
"$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key>",
|
|
17
|
+
"$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>",
|
|
18
|
+
"$ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>",
|
|
19
|
+
"$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>",
|
|
20
|
+
"$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path> ",
|
|
21
|
+
"$ csdx cm:migration --alias --file-path <migration/script/file/path> -k <api-key>"
|
|
22
|
+
],
|
|
23
|
+
"flags": {
|
|
24
|
+
"stack-api-key": {
|
|
25
|
+
"name": "stack-api-key",
|
|
26
|
+
"type": "option",
|
|
27
|
+
"char": "k",
|
|
28
|
+
"description": "With this flag add the API key of your stack.",
|
|
29
|
+
"multiple": false,
|
|
30
|
+
"dependsOn": [
|
|
31
|
+
"authtoken"
|
|
32
|
+
],
|
|
33
|
+
"exclusive": [
|
|
34
|
+
"alias"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"alias": {
|
|
38
|
+
"name": "alias",
|
|
39
|
+
"type": "option",
|
|
40
|
+
"char": "a",
|
|
41
|
+
"description": "Use this flag to add the management token alias.",
|
|
42
|
+
"multiple": false,
|
|
43
|
+
"exclusive": [
|
|
44
|
+
"authtoken"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"file-path": {
|
|
48
|
+
"name": "file-path",
|
|
49
|
+
"type": "option",
|
|
50
|
+
"description": "Use this flag to provide the path of the file of the migration script provided by the user.",
|
|
51
|
+
"multiple": false
|
|
52
|
+
},
|
|
53
|
+
"branch": {
|
|
54
|
+
"name": "branch",
|
|
55
|
+
"type": "option",
|
|
56
|
+
"char": "B",
|
|
57
|
+
"description": "Use this flag to add the branch name where you want to perform the migration.",
|
|
58
|
+
"multiple": false
|
|
59
|
+
},
|
|
60
|
+
"config-file": {
|
|
61
|
+
"name": "config-file",
|
|
62
|
+
"type": "option",
|
|
63
|
+
"description": "[optional] Path of the JSON configuration file",
|
|
64
|
+
"multiple": false
|
|
65
|
+
},
|
|
66
|
+
"config": {
|
|
67
|
+
"name": "config",
|
|
68
|
+
"type": "option",
|
|
69
|
+
"description": "[optional] inline configuration, <key1>:<value1>",
|
|
70
|
+
"multiple": true
|
|
71
|
+
},
|
|
72
|
+
"multiple": {
|
|
73
|
+
"name": "multiple",
|
|
74
|
+
"type": "boolean",
|
|
75
|
+
"description": "This flag helps you to migrate multiple content files in a single instance.",
|
|
76
|
+
"allowNo": false
|
|
77
|
+
},
|
|
78
|
+
"api-key": {
|
|
79
|
+
"name": "api-key",
|
|
80
|
+
"type": "option",
|
|
81
|
+
"char": "k",
|
|
82
|
+
"description": "With this flag add the API key of your stack.",
|
|
83
|
+
"hidden": true,
|
|
84
|
+
"multiple": false,
|
|
85
|
+
"dependsOn": [
|
|
86
|
+
"authtoken"
|
|
87
|
+
],
|
|
88
|
+
"exclusive": [
|
|
89
|
+
"alias"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"authtoken": {
|
|
93
|
+
"name": "authtoken",
|
|
94
|
+
"type": "boolean",
|
|
95
|
+
"char": "A",
|
|
96
|
+
"description": "Use this flag to use the auth token of the current session. After logging in CLI, an auth token is generated for each new session.",
|
|
97
|
+
"hidden": true,
|
|
98
|
+
"allowNo": false,
|
|
99
|
+
"dependsOn": [
|
|
100
|
+
"api-key"
|
|
101
|
+
],
|
|
102
|
+
"exclusive": [
|
|
103
|
+
"alias"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"management-token-alias": {
|
|
107
|
+
"name": "management-token-alias",
|
|
108
|
+
"type": "option",
|
|
109
|
+
"description": "alias of the management token",
|
|
110
|
+
"hidden": true,
|
|
111
|
+
"multiple": false,
|
|
112
|
+
"exclusive": [
|
|
113
|
+
"authtoken"
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"filePath": {
|
|
117
|
+
"name": "filePath",
|
|
118
|
+
"type": "option",
|
|
119
|
+
"char": "n",
|
|
120
|
+
"description": "Use this flag to provide the path of the file of the migration script provided by the user.",
|
|
121
|
+
"hidden": true,
|
|
122
|
+
"multiple": false
|
|
123
|
+
},
|
|
124
|
+
"multi": {
|
|
125
|
+
"name": "multi",
|
|
126
|
+
"type": "boolean",
|
|
127
|
+
"description": "This flag helps you to migrate multiple content files in a single instance.",
|
|
128
|
+
"hidden": true,
|
|
129
|
+
"allowNo": false
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"args": {}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-migration",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"author": "@contentstack",
|
|
5
5
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@contentstack/cli-command": "^1.0
|
|
8
|
-
"@contentstack/
|
|
9
|
-
"@contentstack/
|
|
7
|
+
"@contentstack/cli-command": "^1.1.0",
|
|
8
|
+
"@contentstack/cli-utilities": "^1.1.0",
|
|
9
|
+
"@contentstack/management": "^1.6.1",
|
|
10
10
|
"@oclif/command": "^1.8.16",
|
|
11
11
|
"@oclif/config": "^1.18.3",
|
|
12
12
|
"async": "^3.2.4",
|
|
@@ -19,21 +19,20 @@
|
|
|
19
19
|
"winston": "^3.7.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@oclif/
|
|
23
|
-
"@oclif/plugin-help": "^5.1.12",
|
|
24
|
-
"@oclif/test": "^1.2.8",
|
|
22
|
+
"@oclif/test": "^2.2.10",
|
|
25
23
|
"chai": "^4.3.4",
|
|
26
24
|
"eslint": "^8.18.0",
|
|
27
25
|
"eslint-config-oclif": "^3.1.0",
|
|
28
26
|
"eslint-config-oclif-typescript": "^0.2.0",
|
|
29
27
|
"globby": "^10.0.2",
|
|
30
28
|
"husky": "^4.2.5",
|
|
31
|
-
"jsdoc": "^
|
|
29
|
+
"jsdoc": "^4.0.0",
|
|
32
30
|
"jsdoc-to-markdown": "^7.0.1",
|
|
33
31
|
"mkdirp": "^1.0.4",
|
|
34
32
|
"mocha": "^10.0.0",
|
|
35
33
|
"nock": "^13.1.1",
|
|
36
|
-
"nyc": "^15.1.0"
|
|
34
|
+
"nyc": "^15.1.0",
|
|
35
|
+
"oclif": "^3.1.2"
|
|
37
36
|
},
|
|
38
37
|
"engines": {
|
|
39
38
|
"node": ">=8.3.0"
|
|
@@ -52,19 +51,16 @@
|
|
|
52
51
|
"oclif": {
|
|
53
52
|
"commands": "./src/commands",
|
|
54
53
|
"bin": "csdx",
|
|
55
|
-
"devPlugins": [
|
|
56
|
-
"@oclif/plugin-help"
|
|
57
|
-
],
|
|
58
54
|
"repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-migration/<%- commandPath %>"
|
|
59
55
|
},
|
|
60
|
-
"repository": "contentstack/cli
|
|
56
|
+
"repository": "contentstack/cli",
|
|
61
57
|
"scripts": {
|
|
62
58
|
"postpack": "rm -f oclif.manifest.json",
|
|
63
59
|
"posttest": "eslint ./src",
|
|
64
60
|
"generate-api-ref-md-doc": "nyc jsdoc2md ./src/modules/* > ./docs/api-reference.md",
|
|
65
|
-
"prepack": "oclif
|
|
61
|
+
"prepack": "oclif manifest && oclif readme && npm run generate-api-ref-md-doc",
|
|
66
62
|
"test": "nyc mocha \"test/**/*.test.js\"",
|
|
67
|
-
"version": "oclif
|
|
63
|
+
"version": "oclif readme && git add README.md"
|
|
68
64
|
},
|
|
69
65
|
"csdxConfig": {
|
|
70
66
|
"expiredCommands": {
|
|
@@ -46,8 +46,8 @@ class MigrationCommand extends Command {
|
|
|
46
46
|
|
|
47
47
|
async run() {
|
|
48
48
|
// TODO: filePath validation required.
|
|
49
|
-
const migrationCommandFlags = this.parse(MigrationCommand)
|
|
50
|
-
const { branch } = migrationCommandFlags;
|
|
49
|
+
const { flags: migrationCommandFlags } = await this.parse(MigrationCommand);
|
|
50
|
+
const { branch } = migrationCommandFlags || {};
|
|
51
51
|
const filePath = migrationCommandFlags['file-path'] || migrationCommandFlags.filePath;
|
|
52
52
|
const multi = migrationCommandFlags.multiple || migrationCommandFlags.multi;
|
|
53
53
|
const authtoken = configHandler.get('authtoken');
|