mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
Reduce verbosity of plugin incompatibility errors
Instead of showing a 4-5 line warning for each potentially incompatible plugin, we'll show the warning and then a list of plugins.
This commit is contained in:
@@ -20,7 +20,7 @@ module.exports = function(Plugins) {
|
||||
return callback(pluginPath.match('nodebb-theme') ? null : err);
|
||||
}
|
||||
|
||||
versionWarning(pluginData);
|
||||
checkVersion(pluginData);
|
||||
|
||||
async.parallel([
|
||||
function(next) {
|
||||
@@ -53,20 +53,19 @@ module.exports = function(Plugins) {
|
||||
});
|
||||
};
|
||||
|
||||
function versionWarning(pluginData) {
|
||||
function display() {
|
||||
process.stdout.write('\n');
|
||||
winston.warn('[plugins/' + pluginData.id + '] This plugin may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing.');
|
||||
winston.warn('[plugins/' + pluginData.id + '] In the event of an unresponsive NodeBB caused by this plugin, run ./nodebb reset -p ' + pluginData.id + '.');
|
||||
process.stdout.write('\n');
|
||||
function checkVersion(pluginData) {
|
||||
function add() {
|
||||
if (Plugins.versionWarning.indexOf(pluginData.id) === -1) {
|
||||
Plugins.versionWarning.push(pluginData.id);
|
||||
}
|
||||
}
|
||||
|
||||
if (pluginData.nbbpm && pluginData.nbbpm.compatibility && semver.validRange(pluginData.nbbpm.compatibility)) {
|
||||
if (!semver.satisfies(nconf.get('version'), pluginData.nbbpm.compatibility)) {
|
||||
display();
|
||||
add();
|
||||
}
|
||||
} else {
|
||||
display();
|
||||
add();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user