@cenk1cenk2/oclif-common 5.0.1 → 5.0.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/dist/index.d.ts +3 -5
- package/dist/index.js +28 -29
- package/package.json +4 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command as Command$1, ux, Hook } from '@oclif/core';
|
|
2
2
|
export { Flags, ux } from '@oclif/core';
|
|
3
3
|
import { ExecaChildProcess } from 'execa';
|
|
4
|
-
import { ListrTaskWrapper, ListrContext, Manager, PromptOptions } from 'listr2';
|
|
4
|
+
import { ListrTaskWrapper, splat, ListrContext, Manager, PromptOptions } from 'listr2';
|
|
5
5
|
import { Logger as Logger$1, LeveledLogMethod } from 'winston';
|
|
6
6
|
import fs from 'fs-extra';
|
|
7
7
|
export { default as fs } from 'fs-extra';
|
|
@@ -11,7 +11,6 @@ import { InferredFlags } from '@oclif/core/lib/interfaces';
|
|
|
11
11
|
export { Flag, InferredFlags } from '@oclif/core/lib/interfaces';
|
|
12
12
|
import { FlagInput } from '@oclif/core/lib/interfaces/parser';
|
|
13
13
|
export { Arg, ArgInput, FlagInput } from '@oclif/core/lib/interfaces/parser';
|
|
14
|
-
import * as colorette from 'colorette';
|
|
15
14
|
|
|
16
15
|
type ClassType<T> = new (...args: any[]) => T;
|
|
17
16
|
|
|
@@ -85,6 +84,7 @@ declare class Logger {
|
|
|
85
84
|
run(data: string | Buffer, ...args: any): void;
|
|
86
85
|
end(data: string | Buffer, ...args: any): void;
|
|
87
86
|
stage(data: string | Buffer, ...args: any): void;
|
|
87
|
+
splat(...args: Parameters<typeof splat>): ReturnType<typeof splat>;
|
|
88
88
|
private initiateLogger;
|
|
89
89
|
private parseMessage;
|
|
90
90
|
private logColoring;
|
|
@@ -107,8 +107,6 @@ interface ConfigIterator {
|
|
|
107
107
|
extensions?: ConfigIterator[];
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
declare const color: colorette.Colorette;
|
|
111
|
-
|
|
112
110
|
declare function isVerbose(logLevel: LogLevels): boolean;
|
|
113
111
|
declare function isDebug(logLevel: LogLevels): boolean;
|
|
114
112
|
declare function isSilent(logLevel: LogLevels): boolean;
|
|
@@ -380,4 +378,4 @@ declare const updateNotifierHook: Hook<'init'>;
|
|
|
380
378
|
|
|
381
379
|
declare const storeHook: <T extends Record<PropertyKey, any> = Record<PropertyKey, any>>(cb: (opts: any, store: StoreService<T>) => void) => Hook<'init'>;
|
|
382
380
|
|
|
383
|
-
export { CLI_FLAGS, ClassType, Command, CommonLockerData, ConfigCommand, ConfigCommandChoices, ConfigCommandSetup, ConfigIterator, ConfigService, DataStore, DeepPartial, EnvironmentVariableParser, FileConstants, FileSystemService, GenericParser, GlobalConfig, HelpGroups, InferArgs, InferFlags, JsonParser, LockData, LockableData, LockerService, LogFieldStatus, LogLevels, Logger, LoggerFormat, LoggerOptions, MergeStrategy, ParserService, PipeProcessToLoggerOptions, SetCtxAssignOptions, SetCtxDefaultsOptions, StoreService, UnlockData, ValidatorService, ValidatorServiceOptions, Winston, YamlParser,
|
|
381
|
+
export { CLI_FLAGS, ClassType, Command, CommonLockerData, ConfigCommand, ConfigCommandChoices, ConfigCommandSetup, ConfigIterator, ConfigService, DataStore, DeepPartial, EnvironmentVariableParser, FileConstants, FileSystemService, GenericParser, GlobalConfig, HelpGroups, InferArgs, InferFlags, JsonParser, LockData, LockableData, LockerService, LogFieldStatus, LogLevels, Logger, LoggerFormat, LoggerOptions, MergeStrategy, ParserService, PipeProcessToLoggerOptions, SetCtxAssignOptions, SetCtxDefaultsOptions, StoreService, UnlockData, ValidatorService, ValidatorServiceOptions, Winston, YamlParser, isDebug, isSilent, isVerbose, merge, notFoundHook, pipeProcessThroughListr, pipeProcessToLogger, setCtxAssign, setCtxDefaults, setup, storeHook, uniqueFilter, updateNotifierHook };
|
package/dist/index.js
CHANGED
|
@@ -452,12 +452,6 @@ var ParserService = _ParserService;
|
|
|
452
452
|
__name(ParserService, "ParserService");
|
|
453
453
|
__publicField(ParserService, "instance");
|
|
454
454
|
|
|
455
|
-
// src/utils/color.ts
|
|
456
|
-
var _colorette = require('colorette'); var colorette = _interopRequireWildcard(_colorette);
|
|
457
|
-
var color = colorette.createColors({
|
|
458
|
-
useColor: true
|
|
459
|
-
});
|
|
460
|
-
|
|
461
455
|
// src/utils/environment.ts
|
|
462
456
|
function isVerbose(logLevel) {
|
|
463
457
|
return logLevel === LogLevels.VERBOSE;
|
|
@@ -1026,32 +1020,38 @@ var _Logger = class {
|
|
|
1026
1020
|
status: LogFieldStatus.STAGE
|
|
1027
1021
|
});
|
|
1028
1022
|
}
|
|
1023
|
+
splat(...args) {
|
|
1024
|
+
const message = args.shift();
|
|
1025
|
+
if (typeof message === "undefined") {
|
|
1026
|
+
return "";
|
|
1027
|
+
}
|
|
1028
|
+
if (args.length === 0) {
|
|
1029
|
+
return message;
|
|
1030
|
+
}
|
|
1031
|
+
return _listr2.splat.call(void 0, message, args);
|
|
1032
|
+
}
|
|
1029
1033
|
initiateLogger() {
|
|
1030
1034
|
const logFormat = _winston.format.printf(({ level, message, context, status }) => {
|
|
1031
|
-
|
|
1032
|
-
multiLineMessage = message.split(_os.EOL);
|
|
1033
|
-
multiLineMessage = multiLineMessage.filter((msg) => msg.trim() !== "").filter(Boolean);
|
|
1034
|
-
multiLineMessage = multiLineMessage.map((msg) => {
|
|
1035
|
+
return message.split(_os.EOL).filter((msg) => !msg || msg.trim() !== "").map((msg) => {
|
|
1035
1036
|
return this.logColoring({
|
|
1036
1037
|
level,
|
|
1037
1038
|
message: msg,
|
|
1038
1039
|
context,
|
|
1039
1040
|
status
|
|
1040
1041
|
});
|
|
1041
|
-
});
|
|
1042
|
-
return multiLineMessage.join(_os.EOL);
|
|
1042
|
+
}).join(_os.EOL);
|
|
1043
1043
|
});
|
|
1044
1044
|
const logger = _winston2.default.createLogger({
|
|
1045
1045
|
level: this.options.level,
|
|
1046
1046
|
format: _winston.format.combine(_winston.format.splat(), _winston.format.json({
|
|
1047
1047
|
space: 2
|
|
1048
1048
|
}), _winston.format.prettyPrint(), logFormat),
|
|
1049
|
-
levels: Object.values(LogLevels).
|
|
1050
|
-
return
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
}
|
|
1049
|
+
levels: Object.fromEntries(Object.values(LogLevels).map((level, i) => {
|
|
1050
|
+
return [
|
|
1051
|
+
level,
|
|
1052
|
+
i
|
|
1053
|
+
];
|
|
1054
|
+
})),
|
|
1055
1055
|
silent: this.options.level === LogLevels.SILENT,
|
|
1056
1056
|
transports: [
|
|
1057
1057
|
new _winston.transports.Console({
|
|
@@ -1090,45 +1090,45 @@ var _Logger = class {
|
|
|
1090
1090
|
case LogLevels.DIRECT:
|
|
1091
1091
|
return message;
|
|
1092
1092
|
case LogLevels.FATAL:
|
|
1093
|
-
coloring = /* @__PURE__ */ __name((input) => color.red(input), "coloring");
|
|
1093
|
+
coloring = /* @__PURE__ */ __name((input) => _listr2.color.red(input), "coloring");
|
|
1094
1094
|
if (_optionalChain([this, 'access', _23 => _23.options, 'optionalAccess', _24 => _24.useIcons])) {
|
|
1095
1095
|
icon = _listr2.figures.checkboxOn;
|
|
1096
1096
|
}
|
|
1097
1097
|
break;
|
|
1098
1098
|
case LogLevels.ERROR:
|
|
1099
|
-
coloring = color.red;
|
|
1099
|
+
coloring = _listr2.color.red;
|
|
1100
1100
|
if (_optionalChain([this, 'access', _25 => _25.options, 'optionalAccess', _26 => _26.useIcons])) {
|
|
1101
1101
|
icon = _listr2.figures.cross;
|
|
1102
1102
|
}
|
|
1103
1103
|
break;
|
|
1104
1104
|
case LogLevels.WARN:
|
|
1105
|
-
coloring = color.yellow;
|
|
1105
|
+
coloring = _listr2.color.yellow;
|
|
1106
1106
|
if (_optionalChain([this, 'access', _27 => _27.options, 'optionalAccess', _28 => _28.useIcons])) {
|
|
1107
1107
|
icon = _listr2.figures.warning;
|
|
1108
1108
|
}
|
|
1109
1109
|
break;
|
|
1110
1110
|
case LogLevels.INFO:
|
|
1111
|
-
coloring = color.green;
|
|
1111
|
+
coloring = _listr2.color.green;
|
|
1112
1112
|
if (_optionalChain([this, 'access', _29 => _29.options, 'optionalAccess', _30 => _30.useIcons])) {
|
|
1113
1113
|
icon = _listr2.figures.pointerSmall;
|
|
1114
1114
|
}
|
|
1115
1115
|
break;
|
|
1116
1116
|
case LogLevels.VERBOSE:
|
|
1117
|
-
coloring = color.dim;
|
|
1117
|
+
coloring = _listr2.color.dim;
|
|
1118
1118
|
if (_optionalChain([this, 'access', _31 => _31.options, 'optionalAccess', _32 => _32.useIcons])) {
|
|
1119
1119
|
icon = "\u2607";
|
|
1120
1120
|
}
|
|
1121
1121
|
break;
|
|
1122
1122
|
case LogLevels.DEBUG:
|
|
1123
|
-
coloring = color.cyan;
|
|
1124
|
-
msgColoring = color.dim;
|
|
1123
|
+
coloring = _listr2.color.cyan;
|
|
1124
|
+
msgColoring = _listr2.color.dim;
|
|
1125
1125
|
if (_optionalChain([this, 'access', _33 => _33.options, 'optionalAccess', _34 => _34.useIcons])) {
|
|
1126
1126
|
icon = "\uF188";
|
|
1127
1127
|
}
|
|
1128
1128
|
break;
|
|
1129
1129
|
case LogLevels.TRACE:
|
|
1130
|
-
coloring = color.magenta;
|
|
1131
|
-
msgColoring = color.dim;
|
|
1130
|
+
coloring = _listr2.color.magenta;
|
|
1131
|
+
msgColoring = _listr2.color.dim;
|
|
1132
1132
|
if (_optionalChain([this, 'access', _35 => _35.options, 'optionalAccess', _36 => _36.useIcons])) {
|
|
1133
1133
|
icon = "\u26B1";
|
|
1134
1134
|
}
|
|
@@ -1460,5 +1460,4 @@ var storeHook = /* @__PURE__ */ __name((cb) => async (opts) => {
|
|
|
1460
1460
|
|
|
1461
1461
|
|
|
1462
1462
|
|
|
1463
|
-
|
|
1464
|
-
exports.CLI_FLAGS = CLI_FLAGS; exports.Command = Command; exports.ConfigCommand = ConfigCommand; exports.ConfigService = ConfigService; exports.EnvironmentVariableParser = EnvironmentVariableParser; exports.FileConstants = FileConstants; exports.FileSystemService = FileSystemService; exports.Flags = _core.Flags; exports.HelpGroups = HelpGroups; exports.JsonParser = JsonParser; exports.LockerService = LockerService; exports.LogFieldStatus = LogFieldStatus; exports.LogLevels = LogLevels; exports.Logger = Logger; exports.MergeStrategy = MergeStrategy; exports.ParserService = ParserService; exports.StoreService = StoreService; exports.ValidatorService = ValidatorService; exports.YamlParser = YamlParser; exports.color = color; exports.fs = _fsextra2.default; exports.isDebug = isDebug; exports.isSilent = isSilent; exports.isVerbose = isVerbose; exports.merge = merge; exports.notFoundHook = notFoundHook; exports.pipeProcessThroughListr = pipeProcessThroughListr; exports.pipeProcessToLogger = pipeProcessToLogger; exports.setCtxAssign = setCtxAssign; exports.setCtxDefaults = setCtxDefaults; exports.setup = setup; exports.storeHook = storeHook; exports.uniqueFilter = uniqueFilter; exports.updateNotifierHook = updateNotifierHook; exports.ux = _core.ux;
|
|
1463
|
+
exports.CLI_FLAGS = CLI_FLAGS; exports.Command = Command; exports.ConfigCommand = ConfigCommand; exports.ConfigService = ConfigService; exports.EnvironmentVariableParser = EnvironmentVariableParser; exports.FileConstants = FileConstants; exports.FileSystemService = FileSystemService; exports.Flags = _core.Flags; exports.HelpGroups = HelpGroups; exports.JsonParser = JsonParser; exports.LockerService = LockerService; exports.LogFieldStatus = LogFieldStatus; exports.LogLevels = LogLevels; exports.Logger = Logger; exports.MergeStrategy = MergeStrategy; exports.ParserService = ParserService; exports.StoreService = StoreService; exports.ValidatorService = ValidatorService; exports.YamlParser = YamlParser; exports.fs = _fsextra2.default; exports.isDebug = isDebug; exports.isSilent = isSilent; exports.isVerbose = isVerbose; exports.merge = merge; exports.notFoundHook = notFoundHook; exports.pipeProcessThroughListr = pipeProcessThroughListr; exports.pipeProcessToLogger = pipeProcessToLogger; exports.setCtxAssign = setCtxAssign; exports.setCtxDefaults = setCtxDefaults; exports.setup = setup; exports.storeHook = storeHook; exports.uniqueFilter = uniqueFilter; exports.updateNotifierHook = updateNotifierHook; exports.ux = _core.ux;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cenk1cenk2/oclif-common",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "Oclif common package for oclif2 projects.",
|
|
5
5
|
"repository": "https://gitlab.kilic.dev/libraries/oclif-tools",
|
|
6
6
|
"author": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"class-transformer": ">= 0.5.0",
|
|
42
42
|
"class-validator": ">= 0.14.0",
|
|
43
43
|
"enquirer": ">= 2",
|
|
44
|
-
"execa": ">= 5",
|
|
44
|
+
"execa": ">= 5 < 6",
|
|
45
45
|
"fs-extra": ">= 10",
|
|
46
46
|
"listr2": ">= 6",
|
|
47
|
-
"update-notifier": ">=
|
|
47
|
+
"update-notifier": ">= 5"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"execa": {
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"colorette": "^2.0.19",
|
|
59
58
|
"deepmerge": "^4.3.1",
|
|
60
59
|
"object-path-immutable": "^4.1.2",
|
|
61
60
|
"reflect-metadata": "^0.1.13",
|
|
@@ -74,6 +73,6 @@
|
|
|
74
73
|
"enquirer": "^2.3.6",
|
|
75
74
|
"execa": "^5.1.1",
|
|
76
75
|
"fs-extra": "^11.1.1",
|
|
77
|
-
"listr2": "^6.0.
|
|
76
|
+
"listr2": "^6.0.4"
|
|
78
77
|
}
|
|
79
78
|
}
|