@contentstack/cli-cm-export 1.11.0 → 1.11.1

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 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.0 linux-x64 node-v18.19.1
51
+ @contentstack/cli-cm-export/1.11.1 linux-x64 node-v18.19.1
52
52
  $ csdx --help [COMMAND]
53
53
  USAGE
54
54
  $ csdx COMMAND
@@ -9,7 +9,7 @@ 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 = path_1.default.join(process.cwd(), 'logs');
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);
@@ -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;
@@ -48,15 +48,17 @@ const askUsername = async () => {
48
48
  };
49
49
  exports.askUsername = askUsername;
50
50
  const askExportDir = async () => {
51
- const result = await cli_utilities_1.cliux.inquire({
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
  };
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.11.0",
2
+ "version": "1.11.1",
3
3
  "commands": {
4
4
  "cm:stacks:export": {
5
5
  "id": "cm:stacks:export",
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.0",
4
+ "version": "1.11.1",
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.5.12",
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",