@cenk1cenk2/oclif-common 2.0.1 → 2.1.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 CHANGED
@@ -190,7 +190,7 @@ declare class ConfigService<Config extends BaseConfig = BaseConfig> {
190
190
  parser: ParserService;
191
191
  private readonly logger;
192
192
  constructor(command: Command<any, Config>);
193
- read<T extends LockableData = LockableData>(strategy: MergeStrategy, ...paths: string[]): Promise<T>;
193
+ read<T extends LockableData = LockableData>(paths: string): Promise<T>;
194
194
  write<T extends LockableData = LockableData>(path: string, data: T): Promise<void>;
195
195
  }
196
196
 
package/dist/index.js CHANGED
@@ -698,12 +698,21 @@ var ConfigService = class {
698
698
  this.logger.trace("Created a new instance.");
699
699
  }
700
700
  async read(strategy, ...paths) {
701
+ if (!Array.isArray(paths)) {
702
+ paths = [paths];
703
+ }
701
704
  const configs = await Promise.all(
702
705
  paths.map(async (path) => {
703
- return this.parser.read(path);
706
+ try {
707
+ const config2 = await this.parser.read(path);
708
+ return config2;
709
+ } catch (e) {
710
+ this.logger.trace(e);
711
+ return {};
712
+ }
704
713
  })
705
714
  );
706
- return merge(strategy, {}, ...configs);
715
+ return merge(strategy ?? "OVERWRITE" /* OVERWRITE */, {}, ...configs);
707
716
  }
708
717
  async write(path, data) {
709
718
  return this.parser.write(path, data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/oclif-common",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "Oclif common package for oclif2 projects.",
5
5
  "repository": "https://gitlab.kilic.dev/libraries/oclif-tools",
6
6
  "author": {