Skip to content

Commit

Permalink
refactor: use the lastInput arg to compute the prepare pipeline n…
Browse files Browse the repository at this point in the history
…ext input

Use the `getNextInput`'s provided argument rather than relying on the closure.
  • Loading branch information
pvdlg committed Jul 10, 2018
1 parent 12de628 commit f7f4aab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Expand Up @@ -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};
},
}
);
Expand Down

0 comments on commit f7f4aab

Please sign in to comment.