diff --git a/bin/cli.js b/bin/cli.js index b5647ca..bce6b95 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -10,16 +10,20 @@ const cli = meow( Options --sequential-init Avoid hypothetical concurrent initialization collisions. + --debug Output debugging information. + --help Help info. Examples $ multi-semantic-release `, { flags: { - /*execasync: { + sequentialInit: { type: "boolean", - alias: "sync", - },*/ + }, + debug: { + type: "boolean", + }, }, } ); diff --git a/bin/runner.js b/bin/runner.js index 83c064d..30ee54b 100644 --- a/bin/runner.js +++ b/bin/runner.js @@ -1,4 +1,8 @@ module.exports = (flags) => { + if (flags.debug) { + require("debug").enable("msr:*"); + } + // Imports. const getWorkspacesYarn = require("../lib/getWorkspacesYarn"); const multiSemanticRelease = require("../lib/multiSemanticRelease"); diff --git a/lib/createInlinePluginCreator.js b/lib/createInlinePluginCreator.js index 1b625f9..93450ca 100644 --- a/lib/createInlinePluginCreator.js +++ b/lib/createInlinePluginCreator.js @@ -1,5 +1,5 @@ const { writeFileSync } = require("fs"); -const { once } = require("lodash"); +const debug = require("debug")("msr:inlinePlugin"); const getCommitsFiltered = require("./getCommitsFiltered"); const { getManifest, getIndent } = require("./getManifest"); const hasChangedDeep = require("./hasChangedDeep"); @@ -88,7 +88,11 @@ function createInlinePluginCreator(packages, multiContext, synchronizer) { todo().find((p) => !p._ready) ); - return plugins.verifyConditions(context); + const res = await plugins.verifyConditions(context); + + debug("verified conditions: %s", pkg.name); + + return res; }; /** @@ -129,6 +133,9 @@ function createInlinePluginCreator(packages, multiContext, synchronizer) { // Make sure type is "patch" if the package has any deps that have changed. if (!pkg._nextType && hasChangedDeep(pkg._localDeps)) pkg._nextType = "patch"; + debug("commits analyzed: %s", pkg.name); + debug("release type: %s", pkg._nextType); + // Return type. return pkg._nextType; }; @@ -195,6 +202,8 @@ function createInlinePluginCreator(packages, multiContext, synchronizer) { notes.push(bullets.join("\n")); } + debug("notes generated: %s", pkg.name); + // Return the notes. return notes.join("\n\n"); }; @@ -212,6 +221,8 @@ function createInlinePluginCreator(packages, multiContext, synchronizer) { const res = await plugins.publish(context); + debug("published: %s", pkg.name); + // istanbul ignore next return res.length ? res[0] : {}; }; @@ -232,6 +243,8 @@ function createInlinePluginCreator(packages, multiContext, synchronizer) { }) ); + debug("inlinePlugin created: %s", pkg.name); + return inlinePlugin; } diff --git a/lib/getSynchronizer.js b/lib/getSynchronizer.js index 0dc7f7b..6e032fd 100644 --- a/lib/getSynchronizer.js +++ b/lib/getSynchronizer.js @@ -1,5 +1,6 @@ const EventEmitter = require("promise-events"); const { identity } = require("lodash"); +const debug = require("debug")("msr:synchronizer"); /** * Cross-packages synchronization context. @@ -32,6 +33,8 @@ const getSynchronizer = (packages) => { const emit = (probe, pkg) => { const name = getEventName(probe, pkg); + debug("ready: %s", name); + return store.evt[name] || (store.evt[name] = ee.emit(name)); }; @@ -54,6 +57,7 @@ const getSynchronizer = (packages) => { .filter(filter) .every((p) => p.hasOwnProperty(probe)) ) { + debug("ready: %s", probe); emit(probe); } @@ -65,6 +69,8 @@ const getSynchronizer = (packages) => { if (getLucky[probe]) { return; } + const name = getEventName(probe, pkg); + debug("lucky: %s", name); getLucky[probe] = emit(probe, pkg); };