fix: #8686, deprecate plugin.json/library (#8705)

and also fix deprecated hooks with no alternative
This commit is contained in:
Peter Jaszkowiak
2020-10-01 09:45:27 -06:00
committed by GitHub
parent 39b51707ce
commit 017af63fb0
3 changed files with 33 additions and 17 deletions

View File

@@ -35,12 +35,15 @@ module.exports = function (Plugins) {
return;
}
if (Plugins.deprecatedHooks[data.hook]) {
winston.warn('[plugins/' + id + '] Hook `' + data.hook + '` is deprecated, ' +
(Plugins.deprecatedHooks[data.hook] ?
'please use `' + Plugins.deprecatedHooks[data.hook] + '` instead.' :
'there is no alternative.'
));
// `hasOwnProperty` needed for hooks with no alternative (set to null)
if (Plugins.deprecatedHooks.hasOwnProperty(data.hook)) {
const deprecated = Plugins.deprecatedHooks[data.hook];
if (deprecated) {
winston.warn(`[plugins/${id}] Hook "${data.hook}" is deprecated, please use "${deprecated}" instead.`);
} else {
winston.warn(`[plugins/${id}] Hook "${data.hook}" is deprecated, there is no alternative.`);
}
}
data.id = id;