@contentstack/cli-config 1.14.0 → 1.15.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
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config
18
18
  $ csdx COMMAND
19
19
  running command...
20
20
  $ csdx (--version)
21
- @contentstack/cli-config/1.14.0 linux-x64 node-v22.17.1
21
+ @contentstack/cli-config/1.15.1 linux-x64 node-v22.18.0
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
@@ -326,12 +326,13 @@ Set logging configuration for CLI
326
326
 
327
327
  ```
328
328
  USAGE
329
- $ csdx config:set:log [--level debug|info|warn|error] [--path <value>]
329
+ $ csdx config:set:log [--level debug|info|warn|error] [--path <value>] [--show-console-logs]
330
330
 
331
331
  FLAGS
332
- --level=<option> Set the log level for the CLI.
333
- <options: debug|info|warn|error>
334
- --path=<value> Specify the file path where logs should be saved.
332
+ --level=<option> Set the log level for the CLI.
333
+ <options: debug|info|warn|error>
334
+ --path=<value> Specify the file path where logs should be saved.
335
+ --[no-]show-console-logs Enable console logging.
335
336
 
336
337
  DESCRIPTION
337
338
  Set logging configuration for CLI
@@ -339,7 +340,9 @@ DESCRIPTION
339
340
  EXAMPLES
340
341
  $ csdx config:set:log
341
342
 
342
- $ csdx config:set:log --level debug --path ./logs/app.log
343
+ $ csdx config:set:log --level debug --path ./logs/app.log --show-console-logs
344
+
345
+ $ csdx config:set:log --no-show-console-logs
343
346
  ```
344
347
 
345
348
  _See code: [src/commands/config/set/log.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/set/log.ts)_
@@ -3,14 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const cli_command_1 = require("@contentstack/cli-command");
4
4
  const cli_utilities_1 = require("@contentstack/cli-utilities");
5
5
  const utils_1 = require("../../../utils");
6
- const fs_1 = require("fs");
7
- const path_1 = require("path");
8
6
  class LogSetCommand extends cli_command_1.Command {
9
7
  async run() {
10
8
  try {
11
9
  const { flags } = await this.parse(LogSetCommand);
12
10
  let logLevel = flags['level'];
13
11
  let logPath = flags['path'];
12
+ const showConsoleLogs = flags['show-console-logs'];
14
13
  // Interactive prompts if not passed via flags
15
14
  if (!logLevel) {
16
15
  logLevel = await utils_1.interactive.askLogLevel();
@@ -18,23 +17,16 @@ class LogSetCommand extends cli_command_1.Command {
18
17
  if (!logPath) {
19
18
  logPath = await utils_1.interactive.askLogPath();
20
19
  }
21
- if (logPath) {
22
- const logDir = (0, path_1.dirname)(logPath);
23
- // Check if the directory part of the path exists and is actually a file
24
- if ((0, fs_1.existsSync)(logDir) && (0, fs_1.statSync)(logDir).isFile()) {
25
- throw new cli_utilities_1.CLIError({
26
- message: `The directory path '${logDir}' is a file, not a directory. Please provide a valid directory path for the log file.`,
27
- });
28
- }
29
- }
30
20
  const currentLoggingConfig = cli_utilities_1.configHandler.get('log') || {};
31
21
  if (logLevel)
32
22
  currentLoggingConfig.level = logLevel;
33
23
  if (logPath)
34
24
  currentLoggingConfig.path = logPath;
25
+ currentLoggingConfig['show-console-logs'] = showConsoleLogs;
35
26
  cli_utilities_1.configHandler.set('log', currentLoggingConfig);
36
27
  cli_utilities_1.cliux.success(cli_utilities_1.messageHandler.parse('CLI_CONFIG_LOG_LEVEL_SET', logLevel));
37
28
  cli_utilities_1.cliux.success(cli_utilities_1.messageHandler.parse('CLI_CONFIG_LOG_PATH_SET', logPath));
29
+ cli_utilities_1.cliux.success(cli_utilities_1.messageHandler.parse('CLI_CONFIG_LOG_CONSOLE_SET', String(showConsoleLogs)));
38
30
  cli_utilities_1.cliux.print(cli_utilities_1.messageHandler.parse('CLI_CONFIG_LOG_SET_SUCCESS'), { color: 'green' });
39
31
  }
40
32
  catch (error) {
@@ -45,12 +37,21 @@ class LogSetCommand extends cli_command_1.Command {
45
37
  exports.default = LogSetCommand;
46
38
  LogSetCommand.description = 'Set logging configuration for CLI';
47
39
  LogSetCommand.flags = {
48
- level: cli_utilities_1.flags.string({
40
+ 'level': cli_utilities_1.flags.string({
49
41
  description: 'Set the log level for the CLI.',
50
42
  options: ['debug', 'info', 'warn', 'error'],
51
43
  }),
52
- path: cli_utilities_1.flags.string({
53
- description: ' Specify the file path where logs should be saved.',
44
+ 'path': cli_utilities_1.flags.string({
45
+ description: 'Specify the file path where logs should be saved.',
54
46
  }),
47
+ 'show-console-logs': cli_utilities_1.flags.boolean({
48
+ description: 'Enable console logging.',
49
+ allowNo: true,
50
+ default: false,
51
+ })
55
52
  };
56
- LogSetCommand.examples = ['csdx config:set:log', 'csdx config:set:log --level debug --path ./logs/app.log'];
53
+ LogSetCommand.examples = [
54
+ 'csdx config:set:log',
55
+ 'csdx config:set:log --level debug --path ./logs/app.log --show-console-logs',
56
+ 'csdx config:set:log --no-show-console-logs',
57
+ ];
@@ -1,3 +1,95 @@
1
+ declare const regions: {
2
+ NA: {
3
+ name: string;
4
+ cma: string;
5
+ cda: string;
6
+ uiHost: string;
7
+ developerHubUrl: string;
8
+ launchHubUrl: string;
9
+ personalizeUrl: string;
10
+ };
11
+ 'AWS-NA': {
12
+ name: string;
13
+ cma: string;
14
+ cda: string;
15
+ uiHost: string;
16
+ developerHubUrl: string;
17
+ launchHubUrl: string;
18
+ personalizeUrl: string;
19
+ };
20
+ EU: {
21
+ name: string;
22
+ cma: string;
23
+ cda: string;
24
+ uiHost: string;
25
+ developerHubUrl: string;
26
+ launchHubUrl: string;
27
+ personalizeUrl: string;
28
+ };
29
+ 'AWS-EU': {
30
+ name: string;
31
+ cma: string;
32
+ cda: string;
33
+ uiHost: string;
34
+ developerHubUrl: string;
35
+ launchHubUrl: string;
36
+ personalizeUrl: string;
37
+ };
38
+ AU: {
39
+ name: string;
40
+ cma: string;
41
+ cda: string;
42
+ uiHost: string;
43
+ developerHubUrl: string;
44
+ launchHubUrl: string;
45
+ personalizeUrl: string;
46
+ };
47
+ 'AWS-AU': {
48
+ name: string;
49
+ cma: string;
50
+ cda: string;
51
+ uiHost: string;
52
+ developerHubUrl: string;
53
+ launchHubUrl: string;
54
+ personalizeUrl: string;
55
+ };
56
+ 'AZURE-NA': {
57
+ name: string;
58
+ cma: string;
59
+ cda: string;
60
+ uiHost: string;
61
+ developerHubUrl: string;
62
+ launchHubUrl: string;
63
+ personalizeUrl: string;
64
+ };
65
+ 'AZURE-EU': {
66
+ name: string;
67
+ cma: string;
68
+ cda: string;
69
+ uiHost: string;
70
+ developerHubUrl: string;
71
+ launchHubUrl: string;
72
+ personalizeUrl: string;
73
+ };
74
+ 'GCP-NA': {
75
+ name: string;
76
+ cma: string;
77
+ cda: string;
78
+ uiHost: string;
79
+ developerHubUrl: string;
80
+ launchHubUrl: string;
81
+ personalizeUrl: string;
82
+ };
83
+ 'GCP-EU': {
84
+ name: string;
85
+ cma: string;
86
+ cda: string;
87
+ uiHost: string;
88
+ developerHubUrl: string;
89
+ launchHubUrl: string;
90
+ personalizeUrl: string;
91
+ };
92
+ };
1
93
  declare class UserConfig {
2
94
  /**
3
95
  *
@@ -46,5 +138,6 @@ declare class UserConfig {
46
138
  launchHubUrl: any;
47
139
  };
48
140
  }
141
+ export { regions };
49
142
  declare const _default: UserConfig;
50
143
  export default _default;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.regions = void 0;
3
4
  const cli_utilities_1 = require("@contentstack/cli-utilities");
4
5
  function validURL(str) {
5
6
  const pattern = new RegExp('^(https?:\\/\\/)?' + // protocol (http or https)
@@ -105,6 +106,7 @@ const regions = {
105
106
  personalizeUrl: 'https://gcp-eu-personalize-api.contentstack.com',
106
107
  },
107
108
  };
109
+ exports.regions = regions;
108
110
  class UserConfig {
109
111
  /**
110
112
  *
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "CLI_CONFIG_SET_REGION_DESCRIPTION": "Set region for CLI",
3
3
  "CLI_CONFIG_SET_REGION_FLAG_D_DESCRIPTION": "Custom host to set for content delivery API, if this flag is added then cma and name flags are required",
4
- "CLI_CONFIG_SET_REGION_FLAG_M_DESCRIPTION": "Custom host to set for content management API, if this flag is added then cda and name flags are required",
4
+ "CLI_CONFIG_SET_REGION_FLAG_M_DESCRIPTION": "Custom host to set for content management API, , if this flag is added then cda and name flags are required",
5
5
  "CLI_CONFIG_SET_REGION_FLAG_N_DESCRIPTION": "Name for the region, if this flag is added then cda and cma flags are required",
6
- "CLI_CONFIG_SET_REGION_DEFAULT": "No argument or custom flag provided. Setting region to default AWS-NA",
6
+ "CLI_CONFIG_SET_REGION_DEFAULT": "No argument or custom flag provided. Setting region to default NA",
7
7
  "CLI_CONFIG_GET_REGION_DESCRIPTION": "Get current region set for CLI",
8
8
  "CLI_CONFIG_GET_REGION_NOT_FOUND": "No region found, please set by running command $ csdx config:set:region",
9
9
  "CLI_CONFIG_INQUIRE_REGION_NAME": "Enter custom region name",
@@ -19,5 +19,6 @@
19
19
  "CLI_CONFIG_LOG_NO_CONFIG": "No config found, please set by running command $ csdx config:set:log",
20
20
  "CLI_CONFIG_LOG_SET_SUCCESS": "Log config set successfully",
21
21
  "CLI_CONFIG_LOG_LEVEL_SET": "Log level: '%s'",
22
- "CLI_CONFIG_LOG_PATH_SET": "Log path: '%s'"
23
- }
22
+ "CLI_CONFIG_LOG_PATH_SET": "Log path: '%s'",
23
+ "CLI_CONFIG_LOG_CONSOLE_SET": "Log console: '%s'"
24
+ }
@@ -326,7 +326,8 @@
326
326
  "description": "Set logging configuration for CLI",
327
327
  "examples": [
328
328
  "csdx config:set:log",
329
- "csdx config:set:log --level debug --path ./logs/app.log"
329
+ "csdx config:set:log --level debug --path ./logs/app.log --show-console-logs",
330
+ "csdx config:set:log --no-show-console-logs"
330
331
  ],
331
332
  "flags": {
332
333
  "level": {
@@ -343,11 +344,17 @@
343
344
  "type": "option"
344
345
  },
345
346
  "path": {
346
- "description": " Specify the file path where logs should be saved.",
347
+ "description": "Specify the file path where logs should be saved.",
347
348
  "name": "path",
348
349
  "hasDynamicHelp": false,
349
350
  "multiple": false,
350
351
  "type": "option"
352
+ },
353
+ "show-console-logs": {
354
+ "description": "Enable console logging.",
355
+ "name": "show-console-logs",
356
+ "allowNo": true,
357
+ "type": "boolean"
351
358
  }
352
359
  },
353
360
  "hasDynamicHelp": false,
@@ -536,5 +543,5 @@
536
543
  ]
537
544
  }
538
545
  },
539
- "version": "1.14.0"
546
+ "version": "1.15.1"
540
547
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentstack/cli-config",
3
3
  "description": "Contentstack CLI plugin for configuration",
4
- "version": "1.14.0",
4
+ "version": "1.15.1",
5
5
  "author": "Contentstack",
6
6
  "scripts": {
7
7
  "build": "npm run clean && npm run compile",
@@ -21,8 +21,8 @@
21
21
  "test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
22
22
  },
23
23
  "dependencies": {
24
- "@contentstack/cli-command": "~1.6.0",
25
- "@contentstack/cli-utilities": "~1.13.0",
24
+ "@contentstack/cli-command": "~1.6.1",
25
+ "@contentstack/cli-utilities": "~1.14.0",
26
26
  "@oclif/core": "^4.3.0",
27
27
  "@oclif/plugin-help": "^6.2.28",
28
28
  "lodash": "^4.17.21"