@oclif/core 2.12.0 → 2.13.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/lib/config/config.js +18 -2
- package/package.json +1 -1
package/lib/config/config.js
CHANGED
|
@@ -71,8 +71,24 @@ class Config {
|
|
|
71
71
|
this.topicPermutations = new Permutations();
|
|
72
72
|
this._commands = new Map();
|
|
73
73
|
this._topics = new Map();
|
|
74
|
-
if (options.config)
|
|
75
|
-
|
|
74
|
+
if (options.config) {
|
|
75
|
+
if (Array.isArray(options.config.plugins) && Array.isArray(this.plugins)) {
|
|
76
|
+
// incoming config is v2 with plugins array and this config is v2 with plugins array
|
|
77
|
+
Object.assign(this, options.config);
|
|
78
|
+
}
|
|
79
|
+
else if (Array.isArray(options.config.plugins) && !Array.isArray(this.plugins)) {
|
|
80
|
+
// incoming config is v2 with plugins array and this config is v3 with plugin Map
|
|
81
|
+
Object.assign(this, options.config, { plugins: new Map(options.config.plugins.map(p => [p.name, p])) });
|
|
82
|
+
}
|
|
83
|
+
else if (!Array.isArray(options.config.plugins) && Array.isArray(this.plugins)) {
|
|
84
|
+
// incoming config is v3 with plugin Map and this config is v2 with plugins array
|
|
85
|
+
Object.assign(this, options.config, { plugins: options.config.getPluginsList() });
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
// incoming config is v3 with plugin Map and this config is v3 with plugin Map
|
|
89
|
+
Object.assign(this, options.config);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
76
92
|
}
|
|
77
93
|
static async load(opts = module.filename || __dirname) {
|
|
78
94
|
// Handle the case when a file URL string is passed in such as 'import.meta.url'; covert to file path.
|