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:
parent
fb8f4cc4c2
commit
d6ed202bd9
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue