@cenk1cenk2/oclif-common 1.2.0 → 1.4.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/dist/index.d.ts +14 -4
- package/dist/index.js +8 -19
- package/dist/index.mjs +8 -19
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -89,8 +89,19 @@ declare class BaseConfig {
|
|
|
89
89
|
loglevel: LogLevels;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
declare module 'config' {
|
|
96
|
+
interface IUtil {
|
|
97
|
+
getCustomEnvVars: <T extends Record<string, any>>(path: string, extensions: string[]) => Partial<T>
|
|
98
|
+
parseFile: <T extends Record<string, any>>(path: string, options?: { skipConfigSources?: boolean }) => T
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
92
102
|
declare const color: colorette.Colorette;
|
|
93
103
|
|
|
104
|
+
declare function isVerbose<T extends BaseConfig = BaseConfig>(config: T): boolean;
|
|
94
105
|
declare function isDebug<T extends BaseConfig = BaseConfig>(config: T): boolean;
|
|
95
106
|
declare function isSilent<T extends BaseConfig = BaseConfig>(config: T): boolean;
|
|
96
107
|
|
|
@@ -201,8 +212,6 @@ declare class FileSystemService {
|
|
|
201
212
|
removeFileSync(file: string): void;
|
|
202
213
|
removeDirectory(directory: string): Promise<void>;
|
|
203
214
|
removeDirectorySync(directory: string): void;
|
|
204
|
-
readDir(directory: string): Promise<string[]>;
|
|
205
|
-
readDirSync(directory: string): string[];
|
|
206
215
|
}
|
|
207
216
|
|
|
208
217
|
interface ValidatorServiceOptions {
|
|
@@ -227,8 +236,9 @@ declare class Command<Ctx extends ListrContext = ListrContext, Config extends Ba
|
|
|
227
236
|
logger: Logger;
|
|
228
237
|
tasks: Manager<Ctx, 'default'>;
|
|
229
238
|
validator: ValidatorService;
|
|
230
|
-
|
|
239
|
+
isVerbose: boolean;
|
|
231
240
|
isDebug: boolean;
|
|
241
|
+
isSilent: boolean;
|
|
232
242
|
cs: ConfigService<Config>;
|
|
233
243
|
parser: ParserService;
|
|
234
244
|
fs: FileSystemService;
|
|
@@ -267,4 +277,4 @@ interface ConfigCommandSetup<T extends string> {
|
|
|
267
277
|
locker: LockerService;
|
|
268
278
|
}
|
|
269
279
|
|
|
270
|
-
export { BaseConfig, ClassType, Command, CommonLockerData, ConfigCommandChoices, ConfigCommandSetup, ConfigService, FileConstants, FileSystemService, GenericParser, LockData, LockableData, LockerService, LogFieldStatus, LogLevels, Logger, LoggerFormat, LoggerOptions, MergeStrategy, PipeProcessToLoggerOptions, UnlockData, ValidatorService, ValidatorServiceOptions, WINSTON_INSTANCE, Winston, YamlParser, color, isDebug, isSilent, merge, pipeProcessThroughListr, pipeProcessToLogger, setup };
|
|
280
|
+
export { BaseConfig, ClassType, Command, CommonLockerData, ConfigCommandChoices, ConfigCommandSetup, ConfigService, FileConstants, FileSystemService, GenericParser, LockData, LockableData, LockerService, LogFieldStatus, LogLevels, Logger, LoggerFormat, LoggerOptions, MergeStrategy, PipeProcessToLoggerOptions, UnlockData, ValidatorService, ValidatorServiceOptions, WINSTON_INSTANCE, Winston, YamlParser, color, isDebug, isSilent, isVerbose, merge, pipeProcessThroughListr, pipeProcessToLogger, setup };
|
package/dist/index.js
CHANGED
|
@@ -399,6 +399,7 @@ __export(src_exports, {
|
|
|
399
399
|
fs: () => import_fs_extra.default,
|
|
400
400
|
isDebug: () => isDebug,
|
|
401
401
|
isSilent: () => isSilent,
|
|
402
|
+
isVerbose: () => isVerbose,
|
|
402
403
|
merge: () => merge,
|
|
403
404
|
notFoundHook: () => notFoundHook,
|
|
404
405
|
pipeProcessThroughListr: () => pipeProcessThroughListr,
|
|
@@ -614,24 +615,6 @@ var FileSystemService = class {
|
|
|
614
615
|
throw e;
|
|
615
616
|
}
|
|
616
617
|
}
|
|
617
|
-
async readDir(directory) {
|
|
618
|
-
try {
|
|
619
|
-
const results = await import_fs_extra.default.readdir(directory);
|
|
620
|
-
return results;
|
|
621
|
-
} catch (e) {
|
|
622
|
-
this.logger.fatal('Error while reading directory from "%s": %s', directory, e.message);
|
|
623
|
-
throw e;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
readDirSync(directory) {
|
|
627
|
-
try {
|
|
628
|
-
const results = import_fs_extra.default.readdirSync(directory);
|
|
629
|
-
return results;
|
|
630
|
-
} catch (e) {
|
|
631
|
-
this.logger.fatal('Error while reading directory from "%s": %s', directory, e.message);
|
|
632
|
-
throw e;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
618
|
};
|
|
636
619
|
|
|
637
620
|
// src/lib/parser/parser.service.ts
|
|
@@ -682,6 +665,9 @@ init_color();
|
|
|
682
665
|
|
|
683
666
|
// src/utils/environment.ts
|
|
684
667
|
init_logger2();
|
|
668
|
+
function isVerbose(config2) {
|
|
669
|
+
return config2.loglevel === "VERBOSE" /* VERBOSE */;
|
|
670
|
+
}
|
|
685
671
|
function isDebug(config2) {
|
|
686
672
|
return config2.loglevel === "DEBUG" /* DEBUG */;
|
|
687
673
|
}
|
|
@@ -720,6 +706,7 @@ var ConfigService = class {
|
|
|
720
706
|
} else {
|
|
721
707
|
ConfigService.instance = this;
|
|
722
708
|
}
|
|
709
|
+
process.env.SUPPRESS_NO_CONFIG_WARNING = "1";
|
|
723
710
|
this.command = command.ctor;
|
|
724
711
|
this.oclif = command.config;
|
|
725
712
|
this.config = import_config.default.util.loadFileConfigs(this.dir);
|
|
@@ -940,8 +927,9 @@ var Command = class extends import_core.Command {
|
|
|
940
927
|
}
|
|
941
928
|
async init() {
|
|
942
929
|
this.cs = new ConfigService(this);
|
|
943
|
-
this.
|
|
930
|
+
this.isVerbose = isVerbose(this.cs.config);
|
|
944
931
|
this.isDebug = isDebug(this.cs.config);
|
|
932
|
+
this.isSilent = isSilent(this.cs.config);
|
|
945
933
|
this.logger = new Logger(this.cs.command.id ? this.cs.command.id : this.cs.command.name, { level: this.cs.config.loglevel });
|
|
946
934
|
this.parser = new ParserService();
|
|
947
935
|
this.fs = new FileSystemService();
|
|
@@ -1048,6 +1036,7 @@ __reExport(src_exports, lib_exports, module.exports);
|
|
|
1048
1036
|
fs,
|
|
1049
1037
|
isDebug,
|
|
1050
1038
|
isSilent,
|
|
1039
|
+
isVerbose,
|
|
1051
1040
|
merge,
|
|
1052
1041
|
notFoundHook,
|
|
1053
1042
|
pipeProcessThroughListr,
|
package/dist/index.mjs
CHANGED
|
@@ -403,6 +403,7 @@ __export(src_exports, {
|
|
|
403
403
|
fs: () => fs,
|
|
404
404
|
isDebug: () => isDebug,
|
|
405
405
|
isSilent: () => isSilent,
|
|
406
|
+
isVerbose: () => isVerbose,
|
|
406
407
|
merge: () => merge,
|
|
407
408
|
notFoundHook: () => notFoundHook,
|
|
408
409
|
pipeProcessThroughListr: () => pipeProcessThroughListr,
|
|
@@ -617,24 +618,6 @@ var FileSystemService = class {
|
|
|
617
618
|
throw e;
|
|
618
619
|
}
|
|
619
620
|
}
|
|
620
|
-
async readDir(directory) {
|
|
621
|
-
try {
|
|
622
|
-
const results = await fs.readdir(directory);
|
|
623
|
-
return results;
|
|
624
|
-
} catch (e) {
|
|
625
|
-
this.logger.fatal('Error while reading directory from "%s": %s', directory, e.message);
|
|
626
|
-
throw e;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
readDirSync(directory) {
|
|
630
|
-
try {
|
|
631
|
-
const results = fs.readdirSync(directory);
|
|
632
|
-
return results;
|
|
633
|
-
} catch (e) {
|
|
634
|
-
this.logger.fatal('Error while reading directory from "%s": %s', directory, e.message);
|
|
635
|
-
throw e;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
621
|
};
|
|
639
622
|
|
|
640
623
|
// src/lib/parser/parser.service.ts
|
|
@@ -685,6 +668,9 @@ init_color();
|
|
|
685
668
|
|
|
686
669
|
// src/utils/environment.ts
|
|
687
670
|
init_logger2();
|
|
671
|
+
function isVerbose(config2) {
|
|
672
|
+
return config2.loglevel === "VERBOSE" /* VERBOSE */;
|
|
673
|
+
}
|
|
688
674
|
function isDebug(config2) {
|
|
689
675
|
return config2.loglevel === "DEBUG" /* DEBUG */;
|
|
690
676
|
}
|
|
@@ -723,6 +709,7 @@ var ConfigService = class {
|
|
|
723
709
|
} else {
|
|
724
710
|
ConfigService.instance = this;
|
|
725
711
|
}
|
|
712
|
+
process.env.SUPPRESS_NO_CONFIG_WARNING = "1";
|
|
726
713
|
this.command = command.ctor;
|
|
727
714
|
this.oclif = command.config;
|
|
728
715
|
this.config = config.util.loadFileConfigs(this.dir);
|
|
@@ -943,8 +930,9 @@ var Command = class extends BaseCommand {
|
|
|
943
930
|
}
|
|
944
931
|
async init() {
|
|
945
932
|
this.cs = new ConfigService(this);
|
|
946
|
-
this.
|
|
933
|
+
this.isVerbose = isVerbose(this.cs.config);
|
|
947
934
|
this.isDebug = isDebug(this.cs.config);
|
|
935
|
+
this.isSilent = isSilent(this.cs.config);
|
|
948
936
|
this.logger = new Logger(this.cs.command.id ? this.cs.command.id : this.cs.command.name, { level: this.cs.config.loglevel });
|
|
949
937
|
this.parser = new ParserService();
|
|
950
938
|
this.fs = new FileSystemService();
|
|
@@ -1050,6 +1038,7 @@ export {
|
|
|
1050
1038
|
fs,
|
|
1051
1039
|
isDebug,
|
|
1052
1040
|
isSilent,
|
|
1041
|
+
isVerbose,
|
|
1053
1042
|
merge,
|
|
1054
1043
|
notFoundHook,
|
|
1055
1044
|
pipeProcessThroughListr,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cenk1cenk2/oclif-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Oclif common package for oclif2 projects.",
|
|
5
5
|
"repository": "https://gitlab.kilic.dev/libraries/oclif-tools",
|
|
6
6
|
"author": {
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
"through": "^2.3.8",
|
|
68
68
|
"winston": "^3.8.1",
|
|
69
69
|
"yaml": "^2.1.1",
|
|
70
|
-
"fs-extra": "^10.1.0"
|
|
70
|
+
"fs-extra": "^10.1.0",
|
|
71
|
+
"@types/config": "^3.3.0",
|
|
72
|
+
"@types/fs-extra": "^9.0.13",
|
|
73
|
+
"@types/through": "^0.0.30"
|
|
71
74
|
},
|
|
72
75
|
"devDependencies": {
|
|
73
76
|
"@oclif/core": "^1.13.10",
|
|
74
|
-
"@types/config": "^3.3.0",
|
|
75
|
-
"@types/fs-extra": "^9.0.13",
|
|
76
|
-
"@types/through": "^0.0.30",
|
|
77
77
|
"execa": "^6.1.0"
|
|
78
78
|
}
|
|
79
79
|
}
|