From f7f4aabe9e687480f928dbc240860ac61105e894 Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Fri, 6 Jul 2018 23:49:09 -0400 Subject: [PATCH] refactor: use the `lastInput` arg to compute the `prepare` pipeline next input Use the `getNextInput`'s provided argument rather than relying on the closure. --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 4b9c1f974a..7ded1b0502 100644 --- a/index.js +++ b/index.js @@ -114,17 +114,17 @@ async function run(options, plugins) { await plugins.prepare( {options, logger, lastRelease, commits, nextRelease}, { - getNextInput: async lastResult => { + getNextInput: async ({nextRelease, ...prepareParam}) => { const newGitHead = await getGitHead(); // If previous prepare plugin has created a commit (gitHead changed) - if (lastResult.nextRelease.gitHead !== newGitHead) { + if (nextRelease.gitHead !== newGitHead) { nextRelease.gitHead = newGitHead; // Regenerate the release notes logger.log('Call plugin %s', 'generateNotes'); - [nextRelease.notes] = await plugins.generateNotes(generateNotesParam); + [nextRelease.notes] = await plugins.generateNotes({nextRelease, ...prepareParam}); } // Call the next publish plugin with the updated `nextRelease` - return {options, logger, lastRelease, commits, nextRelease}; + return {...prepareParam, nextRelease}; }, } );