@contentstack/cli-config 1.14.0 → 1.15.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 +9 -6
- package/lib/commands/config/set/log.js +16 -15
- package/messages/index.json +5 -4
- package/oclif.manifest.json +10 -3
- package/package.json +2 -2
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.
|
|
21
|
+
@contentstack/cli-config/1.15.0 linux-x64 node-v22.17.1
|
|
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>
|
|
333
|
-
|
|
334
|
-
--path=<value>
|
|
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: '
|
|
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 = [
|
|
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
|
+
];
|
package/messages/index.json
CHANGED
|
@@ -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
|
|
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
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -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": "
|
|
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.
|
|
546
|
+
"version": "1.15.0"
|
|
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.
|
|
4
|
+
"version": "1.15.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "npm run clean && npm run compile",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@contentstack/cli-command": "~1.6.0",
|
|
25
|
-
"@contentstack/cli-utilities": "~1.13.
|
|
25
|
+
"@contentstack/cli-utilities": "~1.13.1",
|
|
26
26
|
"@oclif/core": "^4.3.0",
|
|
27
27
|
"@oclif/plugin-help": "^6.2.28",
|
|
28
28
|
"lodash": "^4.17.21"
|