@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 +1 -1
- package/dist/index.js +11 -2
- package/package.json +1 -1
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>(
|
|
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
|
-
|
|
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
|
|
715
|
+
return merge(strategy ?? "OVERWRITE" /* OVERWRITE */, {}, ...configs);
|
|
707
716
|
}
|
|
708
717
|
async write(path, data) {
|
|
709
718
|
return this.parser.write(path, data);
|