@contentstack/cli-cm-import-setup 1.1.0 → 1.2.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 +5 -5
- package/lib/utils/import-config-handler.js +2 -2
- package/lib/utils/logger.js +5 -2
- package/oclif.manifest.json +40 -26
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import-setup
|
|
|
47
47
|
$ csdx COMMAND
|
|
48
48
|
running command...
|
|
49
49
|
$ csdx (--version)
|
|
50
|
-
@contentstack/cli-cm-import-setup/1.
|
|
50
|
+
@contentstack/cli-cm-import-setup/1.2.0 linux-x64 node-v22.14.0
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -59,7 +59,7 @@ USAGE
|
|
|
59
59
|
|
|
60
60
|
<!-- commands -->
|
|
61
61
|
* [`csdx cm:stacks:import-setup [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]`](#csdx-cmstacksimport-setup--k-value--d-value--a-value---modules-valuevalue)
|
|
62
|
-
* [`csdx cm:stacks:import-setup [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]`](#csdx-cmstacksimport-setup--k-value--d-value--a-value---modules-valuevalue
|
|
62
|
+
* [`csdx cm:stacks:import-setup [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]`](#csdx-cmstacksimport-setup--k-value--d-value--a-value---modules-valuevalue)
|
|
63
63
|
|
|
64
64
|
## `csdx cm:stacks:import-setup [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]`
|
|
65
65
|
|
|
@@ -67,7 +67,7 @@ Helps to generate mappers and backup folder for importing (overwriting) specific
|
|
|
67
67
|
|
|
68
68
|
```
|
|
69
69
|
USAGE
|
|
70
|
-
$ csdx cm:stacks:import-setup [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]
|
|
70
|
+
$ csdx cm:import-setup cm:stacks:import-setup [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]
|
|
71
71
|
|
|
72
72
|
FLAGS
|
|
73
73
|
-B, --branch=<value> The name of the branch where you want to import your content. If you don't mention the
|
|
@@ -78,7 +78,7 @@ FLAGS
|
|
|
78
78
|
branches involved, then the path should point till the particular branch. For example,
|
|
79
79
|
“-d "C:\Users\Name\Desktop\cli\content\branch_name"
|
|
80
80
|
-k, --stack-api-key=<value> API key of the target stack
|
|
81
|
-
|
|
81
|
+
--module=<option>... [optional] Specify the modules/module to import into the target stack. currently options
|
|
82
82
|
are global-fields, content-types, entries
|
|
83
83
|
<options: global-fields|content-types|entries>
|
|
84
84
|
|
|
@@ -113,7 +113,7 @@ FLAGS
|
|
|
113
113
|
branches involved, then the path should point till the particular branch. For example,
|
|
114
114
|
“-d "C:\Users\Name\Desktop\cli\content\branch_name"
|
|
115
115
|
-k, --stack-api-key=<value> API key of the target stack
|
|
116
|
-
|
|
116
|
+
--module=<option>... [optional] Specify the modules/module to import into the target stack. currently options
|
|
117
117
|
are global-fields, content-types, entries
|
|
118
118
|
<options: global-fields|content-types|entries>
|
|
119
119
|
|
|
@@ -20,13 +20,13 @@ const setupConfig = async (importCmdFlags) => {
|
|
|
20
20
|
// }
|
|
21
21
|
// config = merge.recursive(config, externalConfig);
|
|
22
22
|
// }
|
|
23
|
-
config.contentDir = importCmdFlags['data'] || importCmdFlags['data-dir'] || config.data || (await (0, interactive_1.askContentDir)());
|
|
23
|
+
config.contentDir = (0, cli_utilities_1.sanitizePath)(importCmdFlags['data'] || importCmdFlags['data-dir'] || config.data || (await (0, interactive_1.askContentDir)()));
|
|
24
24
|
const pattern = /[*$%#<>{}!&?]/g;
|
|
25
25
|
if (pattern.test(config.contentDir)) {
|
|
26
26
|
cli_utilities_1.cliux.print(`\nPlease add a directory path without any of the special characters: (*,&,{,},[,],$,%,<,>,?,!)`, {
|
|
27
27
|
color: 'yellow',
|
|
28
28
|
});
|
|
29
|
-
config.contentDir = await (0, interactive_1.askContentDir)();
|
|
29
|
+
config.contentDir = (0, cli_utilities_1.sanitizePath)(await (0, interactive_1.askContentDir)());
|
|
30
30
|
}
|
|
31
31
|
config.contentDir = config.contentDir.replace(/['"]/g, '');
|
|
32
32
|
config.contentDir = path.resolve(config.contentDir);
|
package/lib/utils/logger.js
CHANGED
|
@@ -22,7 +22,10 @@ function returnString(args) {
|
|
|
22
22
|
.map(function (item) {
|
|
23
23
|
if (item && typeof item === 'object') {
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
const redactedObject = (0, cli_utilities_1.redactObject)(item);
|
|
26
|
+
if (redactedObject && typeof redactedObject === 'object') {
|
|
27
|
+
return JSON.stringify(redactedObject);
|
|
28
|
+
}
|
|
26
29
|
}
|
|
27
30
|
catch (error) { }
|
|
28
31
|
return item;
|
|
@@ -122,7 +125,7 @@ function init(_logPath) {
|
|
|
122
125
|
};
|
|
123
126
|
}
|
|
124
127
|
const log = async (config, message, type) => {
|
|
125
|
-
config.cliLogsPath = config.cliLogsPath || config.data || path.join(__dirname, 'logs');
|
|
128
|
+
config.cliLogsPath = (0, cli_utilities_1.sanitizePath)(config.cliLogsPath || config.data || path.join(__dirname, 'logs'));
|
|
126
129
|
// ignoring the type argument, as we are not using it to create a logfile anymore
|
|
127
130
|
if (type !== 'error') {
|
|
128
131
|
// removed type argument from init method
|
package/oclif.manifest.json
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.1.0",
|
|
3
2
|
"commands": {
|
|
4
3
|
"cm:stacks:import-setup": {
|
|
5
|
-
"id": "cm:stacks:import-setup",
|
|
6
|
-
"description": "Helps to generate mappers and backup folder for importing (overwriting) specific modules",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"usage": "cm:stacks:import-setup [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]",
|
|
9
|
-
"pluginName": "@contentstack/cli-cm-import-setup",
|
|
10
|
-
"pluginAlias": "@contentstack/cli-cm-import-setup",
|
|
11
|
-
"pluginType": "core",
|
|
12
4
|
"aliases": [
|
|
13
5
|
"cm:import-setup"
|
|
14
6
|
],
|
|
15
|
-
"
|
|
7
|
+
"args": {},
|
|
8
|
+
"description": "Helps to generate mappers and backup folder for importing (overwriting) specific modules",
|
|
16
9
|
"examples": [
|
|
17
10
|
"csdx cm:stacks:import-setup --stack-api-key <target_stack_api_key> --data-dir <path/of/export/destination/dir> --modules <module_name, module_name>",
|
|
18
11
|
"csdx cm:stacks:import-setup -k <target_stack_api_key> -d <path/of/export/destination/dir> --modules <module_name, module_name>",
|
|
@@ -20,46 +13,67 @@
|
|
|
20
13
|
],
|
|
21
14
|
"flags": {
|
|
22
15
|
"stack-api-key": {
|
|
23
|
-
"name": "stack-api-key",
|
|
24
|
-
"type": "option",
|
|
25
16
|
"char": "k",
|
|
26
17
|
"description": "API key of the target stack",
|
|
27
|
-
"
|
|
18
|
+
"name": "stack-api-key",
|
|
19
|
+
"hasDynamicHelp": false,
|
|
20
|
+
"multiple": false,
|
|
21
|
+
"type": "option"
|
|
28
22
|
},
|
|
29
23
|
"data-dir": {
|
|
30
|
-
"name": "data-dir",
|
|
31
|
-
"type": "option",
|
|
32
24
|
"char": "d",
|
|
33
25
|
"description": "The path or the location in your file system where the content, you intend to import, is stored. For example, -d \"C:\\Users\\Name\\Desktop\\cli\\content\". If the export folder has branches involved, then the path should point till the particular branch. For example, “-d \"C:\\Users\\Name\\Desktop\\cli\\content\\branch_name\"",
|
|
34
|
-
"
|
|
26
|
+
"name": "data-dir",
|
|
27
|
+
"hasDynamicHelp": false,
|
|
28
|
+
"multiple": false,
|
|
29
|
+
"type": "option"
|
|
35
30
|
},
|
|
36
31
|
"alias": {
|
|
37
|
-
"name": "alias",
|
|
38
|
-
"type": "option",
|
|
39
32
|
"char": "a",
|
|
40
33
|
"description": "The management token of the destination stack where you will import the content.",
|
|
41
|
-
"
|
|
34
|
+
"name": "alias",
|
|
35
|
+
"hasDynamicHelp": false,
|
|
36
|
+
"multiple": false,
|
|
37
|
+
"type": "option"
|
|
42
38
|
},
|
|
43
39
|
"module": {
|
|
44
|
-
"name": "module",
|
|
45
|
-
"type": "option",
|
|
46
40
|
"description": "[optional] Specify the modules/module to import into the target stack. currently options are global-fields, content-types, entries",
|
|
41
|
+
"name": "module",
|
|
42
|
+
"hasDynamicHelp": false,
|
|
47
43
|
"multiple": true,
|
|
48
44
|
"options": [
|
|
49
45
|
"global-fields",
|
|
50
46
|
"content-types",
|
|
51
47
|
"entries"
|
|
52
|
-
]
|
|
48
|
+
],
|
|
49
|
+
"type": "option"
|
|
53
50
|
},
|
|
54
51
|
"branch": {
|
|
55
|
-
"name": "branch",
|
|
56
|
-
"type": "option",
|
|
57
52
|
"char": "B",
|
|
58
53
|
"description": "The name of the branch where you want to import your content. If you don't mention the branch name, then by default the content will be imported to the main branch.",
|
|
59
|
-
"
|
|
54
|
+
"name": "branch",
|
|
55
|
+
"hasDynamicHelp": false,
|
|
56
|
+
"multiple": false,
|
|
57
|
+
"type": "option"
|
|
60
58
|
}
|
|
61
59
|
},
|
|
62
|
-
"
|
|
60
|
+
"hasDynamicHelp": false,
|
|
61
|
+
"hiddenAliases": [],
|
|
62
|
+
"id": "cm:stacks:import-setup",
|
|
63
|
+
"pluginAlias": "@contentstack/cli-cm-import-setup",
|
|
64
|
+
"pluginName": "@contentstack/cli-cm-import-setup",
|
|
65
|
+
"pluginType": "core",
|
|
66
|
+
"strict": true,
|
|
67
|
+
"usage": "cm:stacks:import-setup [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]",
|
|
68
|
+
"isESM": false,
|
|
69
|
+
"relativePath": [
|
|
70
|
+
"lib",
|
|
71
|
+
"commands",
|
|
72
|
+
"cm",
|
|
73
|
+
"stacks",
|
|
74
|
+
"import-setup.js"
|
|
75
|
+
]
|
|
63
76
|
}
|
|
64
|
-
}
|
|
77
|
+
},
|
|
78
|
+
"version": "1.2.0"
|
|
65
79
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-import-setup",
|
|
3
3
|
"description": "Contentstack CLI plugin to setup the mappers and configurations for the import command",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-command": "~1.
|
|
9
|
-
"@
|
|
10
|
-
"@
|
|
8
|
+
"@contentstack/cli-command": "~1.5.0",
|
|
9
|
+
"@oclif/core": "^4.2.7",
|
|
10
|
+
"@contentstack/cli-utilities": "~1.11.0",
|
|
11
11
|
"big-json": "^3.2.0",
|
|
12
12
|
"chalk": "^4.1.2",
|
|
13
13
|
"fs-extra": "^11.1.1",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
30
30
|
"chai": "^4.5.0",
|
|
31
31
|
"eslint": "^8.57.1",
|
|
32
|
-
"eslint-config-oclif": "^
|
|
32
|
+
"eslint-config-oclif": "^6.0.15",
|
|
33
33
|
"mocha": "^10.8.2",
|
|
34
34
|
"nyc": "^15.1.0",
|
|
35
|
-
"oclif": "^
|
|
35
|
+
"oclif": "^4.17.30",
|
|
36
36
|
"ts-node": "^10.9.2",
|
|
37
37
|
"typescript": "^4.9.5"
|
|
38
38
|
},
|