@contentstack/cli-migration 1.0.2 → 1.0.4
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 +4 -4
- package/oclif.manifest.json +1 -1
- package/package.json +5 -9
- package/src/commands/cm/stacks/migration.js +35 -31
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g @contentstack/cli-migration
|
|
|
21
21
|
$ csdx COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ csdx (-v|--version|version)
|
|
24
|
-
@contentstack/cli-migration/1.0.
|
|
24
|
+
@contentstack/cli-migration/1.0.4 linux-x64 node-v16.18.1
|
|
25
25
|
$ csdx --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ csdx COMMAND
|
|
@@ -72,6 +72,6 @@ _See code: [src/commands/cm/stacks/migration.js](https://github.com/contentstack
|
|
|
72
72
|
|
|
73
73
|
### Points to remember
|
|
74
74
|
|
|
75
|
-
- Currently,
|
|
76
|
-
-
|
|
77
|
-
- Currently,
|
|
75
|
+
- Currently, you can pass a custom schema to the createField method to migrate group fields.
|
|
76
|
+
- You can migrate global fields by creating an SDK instance and adding it to content types using the createField method.
|
|
77
|
+
- Currently, you can migrate entries by creating an SDK instance to create/update/delete entries for your content type.
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.4","commands":{"cm:stacks:migration":{"id":"cm:stacks:migration","description":"Contentstack migration script.","usage":"cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]","pluginName":"@contentstack/cli-migration","pluginType":"core","aliases":["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 --file-path <migration/script/file/path> -k <api-key>"],"flags":{"stack-api-key":{"name":"stack-api-key","type":"option","char":"k","description":"With this flag add the API key of your stack."},"alias":{"name":"alias","type":"option","char":"a","description":"Use this flag to add the management token alias."},"file-path":{"name":"file-path","type":"option","description":"Use this flag to provide the path of the file of the migration script provided by the user."},"branch":{"name":"branch","type":"option","char":"B","description":"Use this flag to add the branch name where you want to perform the migration."},"config-file":{"name":"config-file","type":"option","description":"[optional] Path of the JSON configuration file"},"config":{"name":"config","type":"option","description":"[optional] inline configuration, <key1>:<value1>"},"multiple":{"name":"multiple","type":"boolean","description":"This flag helps you to migrate multiple content files in a single instance.","allowNo":false},"api-key":{"name":"api-key","type":"option","char":"k","description":"With this flag add the API key of your stack.","hidden":true},"authtoken":{"name":"authtoken","type":"boolean","char":"A","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.","hidden":true,"allowNo":false},"management-token-alias":{"name":"management-token-alias","type":"option","description":"alias of the management token","hidden":true},"filePath":{"name":"filePath","type":"option","char":"n","description":"Use this flag to provide the path of the file of the migration script provided by the user.","hidden":true},"multi":{"name":"multi","type":"boolean","description":"This flag helps you to migrate multiple content files in a single instance.","hidden":true,"allowNo":false}},"args":[]}}}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-migration",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"author": "@contentstack",
|
|
5
5
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@contentstack/cli-command": "^1.0.
|
|
8
|
-
"@contentstack/management": "^1.
|
|
9
|
-
"@contentstack/cli-utilities": "^1.0.
|
|
7
|
+
"@contentstack/cli-command": "^1.0.4",
|
|
8
|
+
"@contentstack/management": "^1.6.0",
|
|
9
|
+
"@contentstack/cli-utilities": "^1.0.5",
|
|
10
10
|
"@oclif/command": "^1.8.16",
|
|
11
11
|
"@oclif/config": "^1.18.3",
|
|
12
12
|
"async": "^3.2.4",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@oclif/dev-cli": "^1.26.0",
|
|
23
|
-
"@oclif/plugin-help": "^5.1.12",
|
|
24
23
|
"@oclif/test": "^1.2.8",
|
|
25
24
|
"chai": "^4.3.4",
|
|
26
25
|
"eslint": "^8.18.0",
|
|
@@ -33,7 +32,7 @@
|
|
|
33
32
|
"mkdirp": "^1.0.4",
|
|
34
33
|
"mocha": "^10.0.0",
|
|
35
34
|
"nock": "^13.1.1",
|
|
36
|
-
"nyc": "^
|
|
35
|
+
"nyc": "^15.1.0"
|
|
37
36
|
},
|
|
38
37
|
"engines": {
|
|
39
38
|
"node": ">=8.3.0"
|
|
@@ -52,9 +51,6 @@
|
|
|
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
56
|
"repository": "contentstack/cli-migration",
|
|
@@ -200,15 +200,15 @@ class MigrationCommand extends Command {
|
|
|
200
200
|
result && results.push(result);
|
|
201
201
|
task.title = successTitle;
|
|
202
202
|
return result;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
205
|
|
|
206
206
|
for (const element of requests) {
|
|
207
207
|
let reqObj = element;
|
|
208
208
|
const { title } = reqObj;
|
|
209
209
|
const taskObj = {
|
|
210
210
|
title: title,
|
|
211
|
-
task: taskFn(reqObj)
|
|
211
|
+
task: taskFn(reqObj),
|
|
212
212
|
};
|
|
213
213
|
_tasks.push(taskObj);
|
|
214
214
|
}
|
|
@@ -233,19 +233,45 @@ class MigrationCommand extends Command {
|
|
|
233
233
|
MigrationCommand.description = 'Contentstack migration script.';
|
|
234
234
|
|
|
235
235
|
MigrationCommand.flags = {
|
|
236
|
-
'api-key': flags.string({
|
|
236
|
+
'stack-api-key': flags.string({
|
|
237
237
|
char: 'k',
|
|
238
238
|
description: 'With this flag add the API key of your stack.',
|
|
239
239
|
dependsOn: ['authtoken'],
|
|
240
240
|
exclusive: ['alias'],
|
|
241
|
-
parse: printFlagDeprecation(['--api-key'], ['-k', '--stack-api-key']),
|
|
242
|
-
hidden: true,
|
|
243
241
|
}),
|
|
244
|
-
|
|
242
|
+
alias: flags.string({
|
|
243
|
+
char: 'a',
|
|
244
|
+
description: 'Use this flag to add the management token alias.',
|
|
245
|
+
exclusive: ['authtoken'],
|
|
246
|
+
}),
|
|
247
|
+
'file-path': flags.string({
|
|
248
|
+
description: 'Use this flag to provide the path of the file of the migration script provided by the user.',
|
|
249
|
+
}),
|
|
250
|
+
branch: flags.string({
|
|
251
|
+
char: 'B',
|
|
252
|
+
description: 'Use this flag to add the branch name where you want to perform the migration.',
|
|
253
|
+
parse: printFlagDeprecation(['-B'], ['--branch']),
|
|
254
|
+
}),
|
|
255
|
+
'config-file': flags.string({
|
|
256
|
+
description: '[optional] Path of the JSON configuration file',
|
|
257
|
+
}),
|
|
258
|
+
config: flags.string({
|
|
259
|
+
description: '[optional] inline configuration, <key1>:<value1>',
|
|
260
|
+
multiple: true,
|
|
261
|
+
}),
|
|
262
|
+
|
|
263
|
+
multiple: flags.boolean({
|
|
264
|
+
description: 'This flag helps you to migrate multiple content files in a single instance.',
|
|
265
|
+
}),
|
|
266
|
+
|
|
267
|
+
//To be deprecated
|
|
268
|
+
'api-key': flags.string({
|
|
245
269
|
char: 'k',
|
|
246
270
|
description: 'With this flag add the API key of your stack.',
|
|
247
271
|
dependsOn: ['authtoken'],
|
|
248
272
|
exclusive: ['alias'],
|
|
273
|
+
parse: printFlagDeprecation(['--api-key'], ['-k', '--stack-api-key']),
|
|
274
|
+
hidden: true,
|
|
249
275
|
}),
|
|
250
276
|
authtoken: flags.boolean({
|
|
251
277
|
char: 'A',
|
|
@@ -256,11 +282,6 @@ MigrationCommand.flags = {
|
|
|
256
282
|
parse: printFlagDeprecation(['-A', '--authtoken']),
|
|
257
283
|
hidden: true,
|
|
258
284
|
}),
|
|
259
|
-
alias: flags.string({
|
|
260
|
-
char: 'a',
|
|
261
|
-
description: 'Use this flag to add the management token alias.',
|
|
262
|
-
exclusive: ['authtoken'],
|
|
263
|
-
}),
|
|
264
285
|
'management-token-alias': flags.string({
|
|
265
286
|
description: 'alias of the management token',
|
|
266
287
|
exclusive: ['authtoken'],
|
|
@@ -273,33 +294,16 @@ MigrationCommand.flags = {
|
|
|
273
294
|
parse: printFlagDeprecation(['-n', '--filePath'], ['--file-path']),
|
|
274
295
|
hidden: true,
|
|
275
296
|
}),
|
|
276
|
-
'file-path': flags.string({
|
|
277
|
-
description: 'Use this flag to provide the path of the file of the migration script provided by the user.',
|
|
278
|
-
}),
|
|
279
|
-
branch: flags.string({
|
|
280
|
-
char: 'B',
|
|
281
|
-
description: 'Use this flag to add the branch name where you want to perform the migration.',
|
|
282
|
-
parse: printFlagDeprecation(['-B'], ['--branch']),
|
|
283
|
-
}),
|
|
284
|
-
'config-file': flags.string({
|
|
285
|
-
description: '[optional] Path of the JSON configuration file',
|
|
286
|
-
}),
|
|
287
|
-
config: flags.string({
|
|
288
|
-
description: '[optional] inline configuration, <key1>:<value1>',
|
|
289
|
-
multiple: true,
|
|
290
|
-
}),
|
|
291
297
|
multi: flags.boolean({
|
|
292
298
|
description: 'This flag helps you to migrate multiple content files in a single instance.',
|
|
293
299
|
parse: printFlagDeprecation(['--multi'], ['--multiple']),
|
|
294
300
|
hidden: true,
|
|
295
301
|
}),
|
|
296
|
-
multiple: flags.boolean({
|
|
297
|
-
description: 'This flag helps you to migrate multiple content files in a single instance.',
|
|
298
|
-
}),
|
|
299
302
|
};
|
|
300
303
|
|
|
301
304
|
MigrationCommand.aliases = ['cm:migration'];
|
|
302
305
|
|
|
303
|
-
MigrationCommand.usage =
|
|
306
|
+
MigrationCommand.usage =
|
|
307
|
+
'cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]';
|
|
304
308
|
|
|
305
309
|
module.exports = MigrationCommand;
|