@cenk1cenk2/oclif-common 3.9.3 → 3.9.5

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.
@@ -402,18 +402,17 @@ var ConfigService = class {
402
402
  this.oclif = oclif;
403
403
  this.command = command;
404
404
  if (ConfigService.instance) {
405
- Object.assign(ConfigService.instance, config);
405
+ if (Object.entries(config).some(([key, value]) => value !== ConfigService.instance[key])) {
406
+ ConfigService.instance.recalculate(config);
407
+ }
406
408
  return ConfigService.instance;
407
- } else {
408
- ConfigService.instance = this;
409
409
  }
410
410
  this.root = this.oclif.root;
411
411
  this.defaults = (0, import_path2.join)(this.oclif.root, "config" /* CONFIG_SERVICE_DEFAULTS_DIR */);
412
412
  this.logger = new Logger(this.constructor.name, { level: config.logLevel });
413
413
  this.parser = new ParserService();
414
- Object.assign(this, config);
414
+ this.recalculate(config);
415
415
  ConfigService.instance = this;
416
- this.recalculate();
417
416
  this.logger.trace("Created a new instance.");
418
417
  }
419
418
  async read(path) {
@@ -525,10 +524,13 @@ var ConfigService = class {
525
524
  async write(path, data) {
526
525
  return this.parser.write(path, data);
527
526
  }
528
- recalculate() {
529
- this.isVerbose = isVerbose(this.logLevel);
530
- this.isDebug = isDebug(this.logLevel);
531
- this.isSilent = isSilent(this.logLevel);
527
+ recalculate(config) {
528
+ this.ci = config.ci;
529
+ this.json = config.json;
530
+ this.logLevel = config.logLevel;
531
+ this.isVerbose = isVerbose(config.logLevel);
532
+ this.isDebug = isDebug(config.logLevel);
533
+ this.isSilent = isSilent(config.logLevel);
532
534
  }
533
535
  };
534
536
  __name(ConfigService, "ConfigService");
@@ -398,18 +398,17 @@ var ConfigService = class {
398
398
  this.oclif = oclif;
399
399
  this.command = command;
400
400
  if (ConfigService.instance) {
401
- Object.assign(ConfigService.instance, config);
401
+ if (Object.entries(config).some(([key, value]) => value !== ConfigService.instance[key])) {
402
+ ConfigService.instance.recalculate(config);
403
+ }
402
404
  return ConfigService.instance;
403
- } else {
404
- ConfigService.instance = this;
405
405
  }
406
406
  this.root = this.oclif.root;
407
407
  this.defaults = (0, import_path2.join)(this.oclif.root, "config" /* CONFIG_SERVICE_DEFAULTS_DIR */);
408
408
  this.logger = new Logger(this.constructor.name, { level: config.logLevel });
409
409
  this.parser = new ParserService();
410
- Object.assign(this, config);
410
+ this.recalculate(config);
411
411
  ConfigService.instance = this;
412
- this.recalculate();
413
412
  this.logger.trace("Created a new instance.");
414
413
  }
415
414
  async read(path) {
@@ -521,10 +520,13 @@ var ConfigService = class {
521
520
  async write(path, data) {
522
521
  return this.parser.write(path, data);
523
522
  }
524
- recalculate() {
525
- this.isVerbose = isVerbose(this.logLevel);
526
- this.isDebug = isDebug(this.logLevel);
527
- this.isSilent = isSilent(this.logLevel);
523
+ recalculate(config) {
524
+ this.ci = config.ci;
525
+ this.json = config.json;
526
+ this.logLevel = config.logLevel;
527
+ this.isVerbose = isVerbose(config.logLevel);
528
+ this.isDebug = isDebug(config.logLevel);
529
+ this.isSilent = isSilent(config.logLevel);
528
530
  }
529
531
  };
530
532
  __name(ConfigService, "ConfigService");
@@ -565,18 +565,17 @@ var ConfigService = class {
565
565
  this.oclif = oclif;
566
566
  this.command = command;
567
567
  if (ConfigService.instance) {
568
- Object.assign(ConfigService.instance, config);
568
+ if (Object.entries(config).some(([key, value]) => value !== ConfigService.instance[key])) {
569
+ ConfigService.instance.recalculate(config);
570
+ }
569
571
  return ConfigService.instance;
570
- } else {
571
- ConfigService.instance = this;
572
572
  }
573
573
  this.root = this.oclif.root;
574
574
  this.defaults = (0, import_path2.join)(this.oclif.root, "config" /* CONFIG_SERVICE_DEFAULTS_DIR */);
575
575
  this.logger = new Logger(this.constructor.name, { level: config.logLevel });
576
576
  this.parser = new ParserService();
577
- Object.assign(this, config);
577
+ this.recalculate(config);
578
578
  ConfigService.instance = this;
579
- this.recalculate();
580
579
  this.logger.trace("Created a new instance.");
581
580
  }
582
581
  async read(path) {
@@ -688,10 +687,13 @@ var ConfigService = class {
688
687
  async write(path, data) {
689
688
  return this.parser.write(path, data);
690
689
  }
691
- recalculate() {
692
- this.isVerbose = isVerbose(this.logLevel);
693
- this.isDebug = isDebug(this.logLevel);
694
- this.isSilent = isSilent(this.logLevel);
690
+ recalculate(config) {
691
+ this.ci = config.ci;
692
+ this.json = config.json;
693
+ this.logLevel = config.logLevel;
694
+ this.isVerbose = isVerbose(config.logLevel);
695
+ this.isDebug = isDebug(config.logLevel);
696
+ this.isSilent = isSilent(config.logLevel);
695
697
  }
696
698
  };
697
699
  __name(ConfigService, "ConfigService");
package/dist/index.d.ts CHANGED
@@ -114,16 +114,11 @@ interface PipeProcessToLoggerOptions {
114
114
  */
115
115
  declare function pipeProcessToLogger(logger: Logger, instance: ExecaChildProcess, options?: PipeProcessToLoggerOptions): ExecaChildProcess;
116
116
 
117
- interface GlobalConfigInit {
117
+ interface GlobalConfig {
118
118
  logLevel: LogLevels;
119
119
  ci: boolean;
120
120
  json: boolean;
121
121
  }
122
- interface GlobalConfig extends GlobalConfigInit {
123
- isVerbose: boolean;
124
- isDebug: boolean;
125
- isSilent: boolean;
126
- }
127
122
  interface ConfigIterator {
128
123
  key: (string | number)[];
129
124
  env: string;
@@ -229,7 +224,7 @@ declare class ConfigService implements GlobalConfig {
229
224
  ci: boolean;
230
225
  json: boolean;
231
226
  private logger;
232
- constructor(oclif: Command['config'], command: Command['ctor'], config: Omit<GlobalConfig, 'isVerbose' | 'isDebug' | 'isSilent'>);
227
+ constructor(oclif: Command['config'], command: Command['ctor'], config: GlobalConfig);
233
228
  read<T extends LockableData = LockableData>(path: string): Promise<T>;
234
229
  extend<T extends LockableData = LockableData>(paths: (string | Partial<T>)[], strategy?: MergeStrategy): Promise<T>;
235
230
  merge<T extends LockableData = LockableData>(configs: Partial<T>[], strategy?: MergeStrategy): T;
@@ -409,4 +404,4 @@ declare enum HelpGroups {
409
404
  CLI = "CLI"
410
405
  }
411
406
 
412
- export { CLI_FLAGS, ClassType, Command, CommonLockerData, ConfigCommand, ConfigCommandChoices, ConfigCommandSetup, ConfigIterator, ConfigService, DeepPartial, EnvironmentVariableParser, FileConstants, FileSystemService, GenericParser, GlobalConfig, GlobalConfigInit, HelpGroups, InferArgs, InferFlags, JsonParser, ListrLogger, LockData, LockableData, LockerService, LogFieldStatus, LogLevels, Logger, LoggerFormat, LoggerOptions, MergeStrategy, ParserService, PipeProcessToLoggerOptions, SetCtxAssignOptions, SetCtxDefaultsOptions, UnlockData, ValidatorService, ValidatorServiceOptions, Winston, YamlParser, color, isDebug, isSilent, isVerbose, merge, pipeProcessThroughListr, pipeProcessToLogger, setCtxAssign, setCtxDefaults, setup, uniqueFilter };
407
+ export { CLI_FLAGS, ClassType, Command, CommonLockerData, ConfigCommand, ConfigCommandChoices, ConfigCommandSetup, ConfigIterator, ConfigService, DeepPartial, EnvironmentVariableParser, FileConstants, FileSystemService, GenericParser, GlobalConfig, HelpGroups, InferArgs, InferFlags, JsonParser, ListrLogger, LockData, LockableData, LockerService, LogFieldStatus, LogLevels, Logger, LoggerFormat, LoggerOptions, MergeStrategy, ParserService, PipeProcessToLoggerOptions, SetCtxAssignOptions, SetCtxDefaultsOptions, UnlockData, ValidatorService, ValidatorServiceOptions, Winston, YamlParser, color, isDebug, isSilent, isVerbose, merge, pipeProcessThroughListr, pipeProcessToLogger, setCtxAssign, setCtxDefaults, setup, uniqueFilter };
package/dist/index.js CHANGED
@@ -461,18 +461,17 @@ var ConfigService = class {
461
461
  this.oclif = oclif;
462
462
  this.command = command;
463
463
  if (ConfigService.instance) {
464
- Object.assign(ConfigService.instance, config);
464
+ if (Object.entries(config).some(([key, value]) => value !== ConfigService.instance[key])) {
465
+ ConfigService.instance.recalculate(config);
466
+ }
465
467
  return ConfigService.instance;
466
- } else {
467
- ConfigService.instance = this;
468
468
  }
469
469
  this.root = this.oclif.root;
470
470
  this.defaults = (0, import_path2.join)(this.oclif.root, "config" /* CONFIG_SERVICE_DEFAULTS_DIR */);
471
471
  this.logger = new Logger(this.constructor.name, { level: config.logLevel });
472
472
  this.parser = new ParserService();
473
- Object.assign(this, config);
473
+ this.recalculate(config);
474
474
  ConfigService.instance = this;
475
- this.recalculate();
476
475
  this.logger.trace("Created a new instance.");
477
476
  }
478
477
  async read(path) {
@@ -584,10 +583,13 @@ var ConfigService = class {
584
583
  async write(path, data) {
585
584
  return this.parser.write(path, data);
586
585
  }
587
- recalculate() {
588
- this.isVerbose = isVerbose(this.logLevel);
589
- this.isDebug = isDebug(this.logLevel);
590
- this.isSilent = isSilent(this.logLevel);
586
+ recalculate(config) {
587
+ this.ci = config.ci;
588
+ this.json = config.json;
589
+ this.logLevel = config.logLevel;
590
+ this.isVerbose = isVerbose(config.logLevel);
591
+ this.isDebug = isDebug(config.logLevel);
592
+ this.isSilent = isSilent(config.logLevel);
591
593
  }
592
594
  };
593
595
  __name(ConfigService, "ConfigService");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/oclif-common",
3
- "version": "3.9.3",
3
+ "version": "3.9.5",
4
4
  "description": "Oclif common package for oclif2 projects.",
5
5
  "repository": "https://gitlab.kilic.dev/libraries/oclif-tools",
6
6
  "author": {
@@ -69,7 +69,7 @@
69
69
  "@oclif/core": "^1.20.4",
70
70
  "@types/fs-extra": "^9.0.13",
71
71
  "@types/through": "^0.0.30",
72
- "@types/update-notifier": "^6",
72
+ "@types/update-notifier": "^5",
73
73
  "class-transformer": "^0.5.1",
74
74
  "class-validator": "^0.13.2",
75
75
  "enquirer": "^2.3.6",