Fix plugin version not being loaded

Load the version of the plugin from its package.json file and document
this requirement in the writing plugins document.
This commit is contained in:
Hornwitser committed 2020-10-23 16:57:49 +02:00
1 parent c5a14db8ea
commit 1b0b245484
3 files changed
+23 -9

No files matched your search

+3
View File
@@ -402,9 +402,11 @@ async function loadPluginInfos(pluginList) {
let plugins = [];
for (let [pluginName, pluginPath] of pluginList) {
let pluginInfo;
let pluginPackage;
try {
pluginInfo = require(path.posix.join(pluginPath, "info"));
pluginPackage = require(path.posix.join(pluginPath, "package.json"));
} catch (err) {
throw new errors.PluginError(pluginName, err);
@@ -417,6 +419,7 @@ async function loadPluginInfos(pluginList) {
}
pluginInfo.requirePath = pluginPath;
pluginInfo.version = pluginPackage.version;
plugins.push(pluginInfo);
}
return plugins;