feat: allow to define plugin options globally
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const {isArray, isObject} = require('lodash');
|
||||
const {isArray, isObject, omit} = require('lodash');
|
||||
const DEFINITIONS = require('./definitions');
|
||||
const pipeline = require('./pipeline');
|
||||
const normalize = require('./normalize');
|
||||
@@ -20,9 +20,11 @@ module.exports = (options, logger) =>
|
||||
pluginConfs = def;
|
||||
}
|
||||
|
||||
const globalOpts = omit(options, Object.keys(DEFINITIONS));
|
||||
|
||||
plugins[pluginType] = isArray(pluginConfs)
|
||||
? pipeline(pluginConfs.map(conf => normalize(pluginType, conf, logger, output)))
|
||||
: normalize(pluginType, pluginConfs, logger, output);
|
||||
? pipeline(pluginConfs.map(conf => normalize(pluginType, globalOpts, conf, logger, output)))
|
||||
: normalize(pluginType, globalOpts, pluginConfs, logger, output);
|
||||
|
||||
return plugins;
|
||||
}, {});
|
||||
|
||||
Reference in New Issue
Block a user