0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-06 22:40:26 -05:00

fix: plugin loader with logs

fix: warn replaced with info
This commit is contained in:
Ayush Sharma 2017-10-05 22:36:58 +05:30
parent fb8f4cc4c2
commit d6ed202bd9

View file

@ -1,6 +1,7 @@
'use strict';
const Path = require('path');
const logger = require('./logger');
/**
* Requires a module.
@ -55,19 +56,22 @@ function load_plugins(config, plugin_configs, params, sanity_check) {
}
if (plugin === null) {
logger.logger.error({content: p}, 'plugin not found. try npm install verdaccio-@{content}');
throw Error('"' + p + '" plugin not found\ntry "npm install verdaccio-' + p + '"');
}
if (typeof(plugin) !== 'function') {
logger.logger.error({content: p}, '@{content} doesn\'t look like a valid plugin');
throw Error('"' + p + '" doesn\'t look like a valid plugin');
}
plugin = plugin(plugin_configs[p], params);
if (plugin === null || !sanity_check(plugin)) {
logger.logger.error({content: p}, '@{content} doesn\'t look like a valid plugin');
throw Error('"' + p + '" doesn\'t look like a valid plugin');
}
logger.logger.info({content: p}, 'Plugin successfully loaded: @{content}');
return plugin;
});