@cenk1cenk2/oclif-common 3.0.0 → 3.0.3
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 +7 -2
- 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): Promise<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
|
@@ -625,11 +625,16 @@ var ConfigService = class {
|
|
|
625
625
|
this.logger.trace("Extending config from: %s", path);
|
|
626
626
|
return config;
|
|
627
627
|
} catch (e) {
|
|
628
|
-
this.logger.trace("Failed to extend config from: %s", e);
|
|
629
|
-
return {};
|
|
628
|
+
this.logger.trace("Failed to extend config from: %s", e.message);
|
|
630
629
|
}
|
|
631
630
|
})
|
|
632
631
|
)).filter(Boolean);
|
|
632
|
+
return this.merge(configs, strategy);
|
|
633
|
+
}
|
|
634
|
+
async 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) {
|