Skip to content

Commit

Permalink
fix: provide partial release
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed May 22, 2020
1 parent 0ecaddf commit 9da295a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/createInlinePluginCreator.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const { writeFileSync } = require("fs");
const { identity } = require("lodash");
const EventEmitter = require("promise-events");
const getCommitsFiltered = require("./getCommitsFiltered");
const getManifest = require("./getManifest");
const hasChangedDeep = require("./hasChangedDeep");
const EventEmitter = require("promise-events");

/**
* Create an inline plugin creator for a multirelease.
Expand All @@ -28,10 +29,14 @@ function createInlinePluginCreator(packages, multiContext) {
todo().forEach((p) => (p._readyForRelease = ee.once(p.name)));

// Status sync point.
const waitFor = (prop) => {
const waitFor = (prop, filter = identity) => {
const promise = ee.once(prop);

if (todo().every((p) => p.hasOwnProperty(prop))) {
if (
todo()
.filter(filter)
.every((p) => p.hasOwnProperty(prop))
) {
ee.emit(prop);
}

Expand Down Expand Up @@ -160,7 +165,7 @@ function createInlinePluginCreator(packages, multiContext) {
// Wait until all todo packages are ready to generate notes.
await waitFor("_nextRelease");

if (packages[0] !== pkg) {
if (todo()[0] !== pkg) {
await pkg._readyForRelease;
}

Expand Down Expand Up @@ -195,14 +200,14 @@ function createInlinePluginCreator(packages, multiContext) {

const publish = async () => {
pkg._prepared = true;
const nextPkgToProcess = todo().find((p) => !p._prepared);
const nextPkgToProcess = todo().find((p) => p._nextType && !p._prepared);

if (nextPkgToProcess) {
ee.emit(nextPkgToProcess.name);
}

// Wait for all packages to be `prepare`d and tagged by `semantic-release`
await waitFor("_prepared");
await waitFor("_prepared", (p) => p._nextType);

return {};
};
Expand Down

0 comments on commit 9da295a

Please sign in to comment.