diff --git a/lib/createInlinePluginCreator.js b/lib/createInlinePluginCreator.js index 944b168d..a3ad5f9f 100644 --- a/lib/createInlinePluginCreator.js +++ b/lib/createInlinePluginCreator.js @@ -1,4 +1,5 @@ const { writeFileSync } = require("fs"); +const { once } = require("lodash"); const { identity } = require("lodash"); const EventEmitter = require("promise-events"); const getCommitsFiltered = require("./getCommitsFiltered"); @@ -28,6 +29,9 @@ function createInlinePluginCreator(packages, multiContext) { // Announcement of readiness for release. todo().forEach((p) => (p._readyForRelease = ee.once(p.name))); + // The first lucky package to be released is marked as `readyForRelease` + const ignition = once((name) => ee.emit(name)); + // Status sync point. const waitFor = (prop, filter = identity) => { const promise = ee.once(prop); @@ -181,9 +185,9 @@ function createInlinePluginCreator(packages, multiContext) { // Wait until all todo packages are ready to generate notes. await waitFor("_nextRelease", (p) => p._nextType); - if (todo()[0] !== pkg) { - await pkg._readyForRelease; - } + // Wait until the current pkg is ready to generate notes + ignition(pkg.name); + await pkg._readyForRelease; // Update pkg deps. updateManifestDeps(pkg, path);