fix: allow plugins to set environment variables to be used by other plugins

This commit is contained in:
Pierre Vanduynslager
2020-02-07 13:51:20 -08:00
committed by Gregor Martynus
parent 8ce2d6e834
commit 68f7e928f9
2 changed files with 51 additions and 2 deletions
+3 -2
View File
@@ -6,7 +6,7 @@ const PLUGINS_DEFINITIONS = require('../definitions/plugins');
const {loadPlugin, parseConfig} = require('./utils');
module.exports = (context, type, pluginOpt, pluginsPath) => {
const {stdout, stderr, options, logger} = context;
const {stdout, stderr, options, logger, env} = context;
if (!pluginOpt) {
return noop;
}
@@ -32,10 +32,11 @@ module.exports = (context, type, pluginOpt, pluginsPath) => {
if (!input.options.dryRun || dryRun) {
logger.log(`Start step "${type}" of plugin "${pluginName}"`);
const result = await func({
...cloneDeep(omit(input, ['stdout', 'stderr', 'logger'])),
...cloneDeep(omit(input, ['stdout', 'stderr', 'logger', 'env'])),
stdout,
stderr,
logger: logger.scope(logger.scopeName, pluginName),
env,
});
if (outputValidator && !outputValidator(result)) {
throw getError(`E${type.toUpperCase()}OUTPUT`, {result, pluginName});