Skip to content

Commit 299748a

Browse files
KillianHmydantongolub
KillianHmyd
authored andcommitted
feat: allow to run prepare steps sequentially
1 parent cdd2f8b commit 299748a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/createInlinePluginCreator.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const { updateManifestDeps, resolveReleaseType } = require("./updateDeps");
1717
function createInlinePluginCreator(packages, multiContext, synchronizer, flags) {
1818
// Vars.
1919
const { cwd } = multiContext;
20-
const { todo, waitFor, waitForAll, emit, getLucky } = synchronizer;
20+
const { todo, waitFor, waitForAll, emit, getLucky, waitLocalDeps } = synchronizer;
2121

2222
/**
2323
* Create an inline plugin for an individual package in a multirelease.
@@ -181,6 +181,11 @@ function createInlinePluginCreator(packages, multiContext, synchronizer, flags)
181181
};
182182

183183
const prepare = async (pluginOptions, context) => {
184+
if (pkg.options.sequentialPrepare) {
185+
debug(debugPrefix, "waiting local dependencies preparation");
186+
await waitLocalDeps("_prepared", pkg);
187+
}
188+
184189
// Wait until the current pkg is ready to be tagged
185190
getLucky("_readyForTagging", pkg);
186191
await waitFor("_readyForTagging", pkg);
@@ -196,6 +201,7 @@ function createInlinePluginCreator(packages, multiContext, synchronizer, flags)
196201
pkg._prepared = true;
197202

198203
debug(debugPrefix, "prepared");
204+
emit("_prepared", pkg);
199205

200206
return res;
201207
};

lib/getSynchronizer.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ const getSynchronizer = (packages) => {
7474
getLucky[probe] = emit(probe, pkg);
7575
};
7676

77+
// Wait that all local deps passes the probe
78+
const waitLocalDeps = (probe, pkg) => {
79+
return Promise.all(pkg.localDeps.map((d) => waitFor(probe, d))).then(() => {
80+
debug(`[${pkg.name}]`, `all local dependencies emitted ${probe}`);
81+
});
82+
};
83+
7784
return {
7885
ee,
7986
emit,
@@ -82,6 +89,7 @@ const getSynchronizer = (packages) => {
8289
waitFor,
8390
waitForAll,
8491
getLucky,
92+
waitLocalDeps,
8593
};
8694
};
8795

0 commit comments

Comments
 (0)