@cenk1cenk2/oclif-common 3.0.1 → 3.0.4
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 -0
- package/dist/index.js +6 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -204,6 +204,7 @@ declare class ConfigService implements GlobalConfig {
|
|
|
204
204
|
constructor(oclif: Command['config'], command: Command['ctor'], config: Omit<GlobalConfig, 'isVerbose' | 'isDebug' | 'isSilent'>);
|
|
205
205
|
read<T extends LockableData = LockableData>(path: string): Promise<T>;
|
|
206
206
|
extend<T extends LockableData = LockableData>(paths: string[], strategy?: MergeStrategy): Promise<T>;
|
|
207
|
+
merge<T extends LockableData = LockableData>(configs: Partial<T>[], strategy?: MergeStrategy): T;
|
|
207
208
|
env<T extends LockableData = LockableData>(definition: string, config: T): Promise<T>;
|
|
208
209
|
write<T extends LockableData = LockableData>(path: string, data: T): Promise<void>;
|
|
209
210
|
private recalculate;
|
package/dist/index.js
CHANGED
|
@@ -626,10 +626,15 @@ var ConfigService = class {
|
|
|
626
626
|
return config;
|
|
627
627
|
} catch (e) {
|
|
628
628
|
this.logger.trace("Failed to extend config from: %s", e.message);
|
|
629
|
-
return {};
|
|
630
629
|
}
|
|
631
630
|
})
|
|
632
631
|
)).filter(Boolean);
|
|
632
|
+
return this.merge(configs, strategy);
|
|
633
|
+
}
|
|
634
|
+
merge(configs, strategy = "OVERWRITE" /* OVERWRITE */) {
|
|
635
|
+
if (configs.length === 0) {
|
|
636
|
+
throw new Error("Nothing to merge, configuration files are empty.");
|
|
637
|
+
}
|
|
633
638
|
return merge(strategy, configs.some((config) => Array.isArray(config)) ? [] : {}, ...configs);
|
|
634
639
|
}
|
|
635
640
|
async env(definition, config) {
|