@contentstack/cli-cm-export 1.11.0 → 1.11.2
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 +1 -1
- package/lib/commands/cm/stacks/export.js +3 -3
- package/lib/types/export-config.d.ts +1 -0
- package/lib/utils/export-config-handler.js +8 -0
- package/lib/utils/interactive.js +3 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/marketplace-app-helper.js +1 -1
- package/oclif.manifest.json +2 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ $ npm install -g @contentstack/cli-cm-export
|
|
|
48
48
|
$ csdx COMMAND
|
|
49
49
|
running command...
|
|
50
50
|
$ csdx (--version)
|
|
51
|
-
@contentstack/cli-cm-export/1.11.
|
|
51
|
+
@contentstack/cli-cm-export/1.11.2 linux-x64 node-v18.20.2
|
|
52
52
|
$ csdx --help [COMMAND]
|
|
53
53
|
USAGE
|
|
54
54
|
$ csdx COMMAND
|
|
@@ -9,13 +9,13 @@ const utils_1 = require("../../../utils");
|
|
|
9
9
|
class ExportCommand extends cli_command_1.Command {
|
|
10
10
|
async run() {
|
|
11
11
|
var _a;
|
|
12
|
-
let exportDir =
|
|
12
|
+
let exportDir = (0, cli_utilities_1.pathValidator)('logs');
|
|
13
13
|
try {
|
|
14
14
|
const { flags } = await this.parse(ExportCommand);
|
|
15
15
|
let exportConfig = await (0, utils_1.setupExportConfig)(flags);
|
|
16
16
|
// Note setting host to create cma client
|
|
17
17
|
exportConfig.host = this.cmaHost;
|
|
18
|
-
exportDir = exportConfig.data || exportConfig.exportDir;
|
|
18
|
+
exportDir = exportConfig.cliLogsPath || exportConfig.data || exportConfig.exportDir;
|
|
19
19
|
const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(exportConfig);
|
|
20
20
|
const moduleExporter = new export_1.ModuleExporter(managementAPIClient, exportConfig);
|
|
21
21
|
await moduleExporter.start();
|
|
@@ -23,7 +23,7 @@ class ExportCommand extends cli_command_1.Command {
|
|
|
23
23
|
(0, utils_1.writeExportMetaFile)(exportConfig);
|
|
24
24
|
}
|
|
25
25
|
(0, utils_1.log)(exportConfig, `The content of the stack ${exportConfig.apiKey} has been exported successfully!`, 'success');
|
|
26
|
-
(0, utils_1.log)(exportConfig, `The log has been stored at '${path_1.default.join(exportDir, 'logs', 'export')}'`, 'success');
|
|
26
|
+
(0, utils_1.log)(exportConfig, `The log has been stored at '${(0, cli_utilities_1.pathValidator)(path_1.default.join(exportDir, 'logs', 'export'))}'`, 'success');
|
|
27
27
|
}
|
|
28
28
|
catch (error) {
|
|
29
29
|
(0, utils_1.log)({ data: exportDir }, `Failed to export stack content - ${(0, utils_1.formatError)(error)}`, 'error');
|
|
@@ -17,6 +17,14 @@ const setupConfig = async (exportCmdFlags) => {
|
|
|
17
17
|
config = merge_1.default.recursive(config, externalConfig);
|
|
18
18
|
}
|
|
19
19
|
config.exportDir = exportCmdFlags['data'] || exportCmdFlags['data-dir'] || config.data || (await (0, interactive_1.askExportDir)());
|
|
20
|
+
const pattern = /[*$%#<>{}!&?]/g;
|
|
21
|
+
if (pattern.test(config.exportDir)) {
|
|
22
|
+
cli_utilities_1.cliux.print(`\nPlease add a directory path without any of the special characters: (*,&,{,},[,],$,%,<,>,?,!)`, {
|
|
23
|
+
color: 'yellow',
|
|
24
|
+
});
|
|
25
|
+
config.exportDir = await (0, interactive_1.askExportDir)();
|
|
26
|
+
}
|
|
27
|
+
config.exportDir = config.exportDir.replace(/['"]/g, '');
|
|
20
28
|
config.exportDir = path.resolve(config.exportDir);
|
|
21
29
|
//Note to support the old key
|
|
22
30
|
config.data = config.exportDir;
|
package/lib/utils/interactive.js
CHANGED
|
@@ -48,15 +48,17 @@ const askUsername = async () => {
|
|
|
48
48
|
};
|
|
49
49
|
exports.askUsername = askUsername;
|
|
50
50
|
const askExportDir = async () => {
|
|
51
|
-
|
|
51
|
+
let result = await cli_utilities_1.cliux.inquire({
|
|
52
52
|
type: 'input',
|
|
53
53
|
message: 'Enter the path for storing the content: (current folder)',
|
|
54
54
|
name: 'dir',
|
|
55
|
+
validate: cli_utilities_1.validatePath,
|
|
55
56
|
});
|
|
56
57
|
if (!result) {
|
|
57
58
|
return process.cwd();
|
|
58
59
|
}
|
|
59
60
|
else {
|
|
61
|
+
result = result.replace(/['"]/g, '');
|
|
60
62
|
return path.resolve(result);
|
|
61
63
|
}
|
|
62
64
|
};
|
package/lib/utils/logger.js
CHANGED
|
@@ -122,7 +122,7 @@ function init(_logPath) {
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
const log = async (config, message, type) => {
|
|
125
|
-
const logsPath = config.data;
|
|
125
|
+
const logsPath = config.cliLogsPath || config.data;
|
|
126
126
|
// ignoring the type argument, as we are not using it to create a logfile anymore
|
|
127
127
|
if (type !== 'error') {
|
|
128
128
|
// removed type argument from init method
|
|
@@ -33,7 +33,7 @@ async function createNodeCryptoInstance(config) {
|
|
|
33
33
|
return "Encryption key can't be empty.";
|
|
34
34
|
return true;
|
|
35
35
|
},
|
|
36
|
-
message: 'Enter
|
|
36
|
+
message: 'Enter Marketplace app configurations encryption key',
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
return new cli_utilities_1.NodeCrypto(cryptoArgs);
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.11.
|
|
2
|
+
"version": "1.11.2",
|
|
3
3
|
"commands": {
|
|
4
4
|
"cm:stacks:export": {
|
|
5
5
|
"id": "cm:stacks:export",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"aliases": [
|
|
13
13
|
"cm:export"
|
|
14
14
|
],
|
|
15
|
+
"hiddenAliases": [],
|
|
15
16
|
"examples": [
|
|
16
17
|
"csdx cm:stacks:export --stack-api-key <stack_api_key> --data-dir <path/of/export/destination/dir>",
|
|
17
18
|
"csdx cm:stacks:export --config <path/to/config/dir>",
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-export",
|
|
3
3
|
"description": "Contentstack CLI plugin to export content from stack",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.2",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@contentstack/cli-command": "~1.2.16",
|
|
9
|
-
"@contentstack/cli-utilities": "~1.
|
|
9
|
+
"@contentstack/cli-utilities": "~1.6.0",
|
|
10
10
|
"@oclif/core": "^2.9.3",
|
|
11
11
|
"async": "^3.2.4",
|
|
12
12
|
"big-json": "^3.2.0",
|
|
@@ -98,4 +98,4 @@
|
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
"repository": "https://github.com/contentstack/cli"
|
|
101
|
-
}
|
|
101
|
+
}
|