@reelout/core 0.9.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer.js +1 -1
- package/dist/builder.js +1 -1
- package/dist/changelog.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{workflow-jcFymxIW.js → workflow-Dk-fKaAx.js} +137 -83
- package/dist/{workflow-jcFymxIW.js.map → workflow-Dk-fKaAx.js.map} +1 -1
- package/package.json +1 -1
- package/src/plugin/HookManager.ts +52 -14
- package/src/types.ts +2 -0
- package/src/workflow/executeReleaseWorkflow.ts +94 -65
- package/src/workflow/report/appendReleaseReportSummary.ts +9 -4
- package/src/workflow/report/generateReleaseReport.ts +4 -2
- package/src/workflow/report/printReleaseReport.ts +5 -2
package/dist/analyzer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as resolvePackageTag, dt as deriveTransitionReleases, ft as deriveChangeReleases, g as propagateDependencyUpdates, h as readPackageHistory, l as version } from "./workflow-
|
|
1
|
+
import { _ as resolvePackageTag, dt as deriveTransitionReleases, ft as deriveChangeReleases, g as propagateDependencyUpdates, h as readPackageHistory, l as version } from "./workflow-Dk-fKaAx.js";
|
|
2
2
|
// src/analyzer.ts
|
|
3
3
|
/**
|
|
4
4
|
* Built-in plugin that inspects repository history and produces release plans for packages.
|
package/dist/builder.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as generateGitTagName, Ut as isSameReleaseCycle, h as readPackageHistory, l as version, p as buildReleaseNotes, qt as bumpVersion, v as resolvePackageStableTag } from "./workflow-
|
|
1
|
+
import { M as generateGitTagName, Ut as isSameReleaseCycle, h as readPackageHistory, l as version, p as buildReleaseNotes, qt as bumpVersion, v as resolvePackageStableTag } from "./workflow-Dk-fKaAx.js";
|
|
2
2
|
import { t as formatError } from "./formatError-BMsun8Wi.js";
|
|
3
3
|
import { colors } from "consola/utils";
|
|
4
4
|
// src/builder.ts
|
package/dist/changelog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as resolvePackageTag, b as discoverPackageTag, l as version, m as buildChangelog, s as HookPriority, u as writeChangelog } from "./workflow-
|
|
1
|
+
import { _ as resolvePackageTag, b as discoverPackageTag, l as version, m as buildChangelog, s as HookPriority, u as writeChangelog } from "./workflow-Dk-fKaAx.js";
|
|
2
2
|
import { t as formatError } from "./formatError-BMsun8Wi.js";
|
|
3
3
|
import { colors } from "consola/utils";
|
|
4
4
|
// src/changelog.ts
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as isGitShallowRepository, A as getGitTagMessage, At as execGit, B as getGitRemote, Bt as SEMVER_REGEX, C as iterateChangelogVersions, Ct as readJson, D as isGitTagExact, Dt as isTruthyString, E as buildDependencyGraph, Et as isClass, F as deleteGitTag, Ft as ALL_FILES, G as readGitHistory, Gt as pickPriorityReleaseType, H as getGitConfigValue, Ht as isStableVersion, I as createGitTag, It as DEFAULT_CHANGELOG_FILE, J as detectGitRelationship, Jt as extractVersionQualifier, K as mergeGitHistory, Kt as deriveCommitReleaseType, L as readGitFile, Lt as DEV_NULL, M as generateGitTagName, Mt as compact, N as ensureGitTag, Nt as isDefined, O as isGitTagConnected, Ot as interpolate, P as isGitTagPresent, Pt as buildTrailerPattern, Q as withShallowLock, R as resolveGitRepository, Rt as GIT_TRAILER_RELEASE_AGENT, S as extractLatestVersion, St as unique, T as extractPlainText, Tt as isGitHubActions, U as restoreFullGitHistory, Ut as isSameReleaseCycle, V as ensureGitUserConfig, Vt as promotePrereleaseVersions, W as readParsedGitHistory, Wt as deriveReleaseType, X as resolveGitRevision, Y as expandGitHistory, Z as isGitAncestor, _ as resolvePackageTag, _t as isSemVerGitTag, a as appendReleaseReportSummary, at as parseGitPrettyFormat, b as discoverPackageTag, bt as createPlugin, c as generateReleaseCommitMessage, ct as extractMentions, d as prependChangelog, dt as deriveTransitionReleases, et as countGitHistory, f as extractPreviousVersion, ft as deriveChangeReleases, g as propagateDependencyUpdates, gt as sanitizePrereleaseLabel, h as readPackageHistory, ht as resolveReleaseChannel, i as generateReleaseReport, it as GIT_PRETTY_FORMAT, j as getCurrentGitTag, jt as execCommand, k as getLatestGitTag, kt as formatFile, lt as createGitCommit, m as buildChangelog, mt as resolveVersionQualifier, n as printReleaseReportAnnotation, nt as getParsedGitCommit, o as HookManager, ot as parseGitCommit, p as buildReleaseNotes, pt as packageContainsCommit, q as GIT_REL_FLAGS, qt as bumpVersion, r as printReleaseReport, rt as GIT_PRETTY_FIELD_SEPARATOR, s as HookPriority, st as TTLCache, t as executeReleaseWorkflow, tt as getCurrentGitCommit, u as writeChangelog, ut as getCurrentGitBranch, v as resolvePackageStableTag, vt as isSemVer, w as extractSemVer, wt as isMatch, x as verifyPackageTag, xt as writeJson, y as filterPackages, yt as findReleaseRule, z as pushGitChanges, zt as RELEASE_HOOK_NAMES } from "./workflow-
|
|
1
|
+
import { $ as isGitShallowRepository, A as getGitTagMessage, At as execGit, B as getGitRemote, Bt as SEMVER_REGEX, C as iterateChangelogVersions, Ct as readJson, D as isGitTagExact, Dt as isTruthyString, E as buildDependencyGraph, Et as isClass, F as deleteGitTag, Ft as ALL_FILES, G as readGitHistory, Gt as pickPriorityReleaseType, H as getGitConfigValue, Ht as isStableVersion, I as createGitTag, It as DEFAULT_CHANGELOG_FILE, J as detectGitRelationship, Jt as extractVersionQualifier, K as mergeGitHistory, Kt as deriveCommitReleaseType, L as readGitFile, Lt as DEV_NULL, M as generateGitTagName, Mt as compact, N as ensureGitTag, Nt as isDefined, O as isGitTagConnected, Ot as interpolate, P as isGitTagPresent, Pt as buildTrailerPattern, Q as withShallowLock, R as resolveGitRepository, Rt as GIT_TRAILER_RELEASE_AGENT, S as extractLatestVersion, St as unique, T as extractPlainText, Tt as isGitHubActions, U as restoreFullGitHistory, Ut as isSameReleaseCycle, V as ensureGitUserConfig, Vt as promotePrereleaseVersions, W as readParsedGitHistory, Wt as deriveReleaseType, X as resolveGitRevision, Y as expandGitHistory, Z as isGitAncestor, _ as resolvePackageTag, _t as isSemVerGitTag, a as appendReleaseReportSummary, at as parseGitPrettyFormat, b as discoverPackageTag, bt as createPlugin, c as generateReleaseCommitMessage, ct as extractMentions, d as prependChangelog, dt as deriveTransitionReleases, et as countGitHistory, f as extractPreviousVersion, ft as deriveChangeReleases, g as propagateDependencyUpdates, gt as sanitizePrereleaseLabel, h as readPackageHistory, ht as resolveReleaseChannel, i as generateReleaseReport, it as GIT_PRETTY_FORMAT, j as getCurrentGitTag, jt as execCommand, k as getLatestGitTag, kt as formatFile, lt as createGitCommit, m as buildChangelog, mt as resolveVersionQualifier, n as printReleaseReportAnnotation, nt as getParsedGitCommit, o as HookManager, ot as parseGitCommit, p as buildReleaseNotes, pt as packageContainsCommit, q as GIT_REL_FLAGS, qt as bumpVersion, r as printReleaseReport, rt as GIT_PRETTY_FIELD_SEPARATOR, s as HookPriority, st as TTLCache, t as executeReleaseWorkflow, tt as getCurrentGitCommit, u as writeChangelog, ut as getCurrentGitBranch, v as resolvePackageStableTag, vt as isSemVer, w as extractSemVer, wt as isMatch, x as verifyPackageTag, xt as writeJson, y as filterPackages, yt as findReleaseRule, z as pushGitChanges, zt as RELEASE_HOOK_NAMES } from "./workflow-Dk-fKaAx.js";
|
|
2
2
|
import { t as formatError } from "./formatError-BMsun8Wi.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
@@ -2384,7 +2384,7 @@ async function writeChangelog(cwd, plan) {
|
|
|
2384
2384
|
}
|
|
2385
2385
|
}
|
|
2386
2386
|
// package.json
|
|
2387
|
-
var version = "0.
|
|
2387
|
+
var version = "0.10.0";
|
|
2388
2388
|
// src/workflow/commit/generateReleaseCommitMessage.ts
|
|
2389
2389
|
var NOTABLE_TYPES = [
|
|
2390
2390
|
"feat",
|
|
@@ -2466,6 +2466,16 @@ var HookPriority = {
|
|
|
2466
2466
|
*/
|
|
2467
2467
|
var HookManager = class {
|
|
2468
2468
|
#registry = /* @__PURE__ */ new Map();
|
|
2469
|
+
#middleware;
|
|
2470
|
+
/**
|
|
2471
|
+
* Create a hook manager.
|
|
2472
|
+
*
|
|
2473
|
+
* @param middleware Wrapper invoked in place of every registered handler
|
|
2474
|
+
* during emission
|
|
2475
|
+
*/
|
|
2476
|
+
constructor(middleware) {
|
|
2477
|
+
this.#middleware = middleware;
|
|
2478
|
+
}
|
|
2469
2479
|
/**
|
|
2470
2480
|
* Register a handler function for a specific hook.
|
|
2471
2481
|
*
|
|
@@ -2503,9 +2513,10 @@ var HookManager = class {
|
|
|
2503
2513
|
/**
|
|
2504
2514
|
* Trigger execution of all handlers registered to a hook.
|
|
2505
2515
|
*
|
|
2506
|
-
* Passes `context` through the handler pipeline in descending priority order
|
|
2507
|
-
*
|
|
2508
|
-
*
|
|
2516
|
+
* Passes `context` through the handler pipeline in descending priority order
|
|
2517
|
+
* and dispatches each registration through the constructor middleware when
|
|
2518
|
+
* one is provided. Enables handlers to control execution flow using `next`
|
|
2519
|
+
* and executes `done` after the last handler completes.
|
|
2509
2520
|
*
|
|
2510
2521
|
* @param name Name of the hook to trigger
|
|
2511
2522
|
* @param context Shared payload passed into each handler
|
|
@@ -2514,15 +2525,17 @@ var HookManager = class {
|
|
|
2514
2525
|
*/
|
|
2515
2526
|
async emit(name, context, done) {
|
|
2516
2527
|
const registrations = this.#registry.get(name) ?? [];
|
|
2528
|
+
const middleware = this.#middleware;
|
|
2517
2529
|
const dispatch = async (index, context) => {
|
|
2518
2530
|
const registration = registrations[index];
|
|
2519
2531
|
if (!registration) return done ? await done(context) : void 0;
|
|
2520
2532
|
let isNextCalled = false;
|
|
2521
|
-
|
|
2533
|
+
const next = async (context) => {
|
|
2522
2534
|
if (isNextCalled) return;
|
|
2523
2535
|
isNextCalled = true;
|
|
2524
2536
|
return await dispatch(index + 1, context);
|
|
2525
|
-
}
|
|
2537
|
+
};
|
|
2538
|
+
return await (middleware ? (context, next) => middleware(context, registration, next) : registration.handler)(context, next);
|
|
2526
2539
|
};
|
|
2527
2540
|
return await dispatch(0, context);
|
|
2528
2541
|
}
|
|
@@ -2565,9 +2578,11 @@ var STATUS_LABELS = {
|
|
|
2565
2578
|
*
|
|
2566
2579
|
* Detects a GitHub Actions runner through the `GITHUB_ACTIONS` environment
|
|
2567
2580
|
* variable and appends the rendered `report` to the file referenced by
|
|
2568
|
-
* `GITHUB_STEP_SUMMARY`, so GitHub displays it on the run summary page.
|
|
2569
|
-
*
|
|
2570
|
-
*
|
|
2581
|
+
* `GITHUB_STEP_SUMMARY`, so GitHub displays it on the run summary page. Dry
|
|
2582
|
+
* runs append a `(dry run)` marker to the status line; real releases render
|
|
2583
|
+
* the status unmarked. Does nothing outside GitHub Actions or when no summary
|
|
2584
|
+
* file is configured, and logs a warning instead of throwing when the summary
|
|
2585
|
+
* file cannot be written.
|
|
2571
2586
|
*
|
|
2572
2587
|
* @param logger Logger instance for reporting summary write failures
|
|
2573
2588
|
* @param env Readonly process environment variables object
|
|
@@ -2589,7 +2604,11 @@ var formatPackageLabel = (plan) => {
|
|
|
2589
2604
|
};
|
|
2590
2605
|
var formatReleaseReportSummary = (report) => {
|
|
2591
2606
|
const lines = ["## ReelOut Release Report", ""];
|
|
2592
|
-
if (report.outcome)
|
|
2607
|
+
if (report.outcome) {
|
|
2608
|
+
const status = STATUS_LABELS[report.outcome.status];
|
|
2609
|
+
const label = report.dryRun ? `${status} (dry run)` : status;
|
|
2610
|
+
lines.push(`**Status:** ${label}`, "");
|
|
2611
|
+
}
|
|
2593
2612
|
if (report.outcome?.status === "failure") {
|
|
2594
2613
|
const message = resolveOutcomeErrorMessage(report.outcome);
|
|
2595
2614
|
lines.push(...message.split("\n").map((line) => `> ${line}`), "");
|
|
@@ -2623,14 +2642,16 @@ var formatReleaseReportSummary = (report) => {
|
|
|
2623
2642
|
* Generate a structured release report from the current workflow state.
|
|
2624
2643
|
*
|
|
2625
2644
|
* Extracts state information from `context` and organizes it into a report
|
|
2626
|
-
* containing the terminal release outcome, release plans,
|
|
2627
|
-
* metadata. Omits unversioned release plans from the finalized
|
|
2645
|
+
* containing the `dryRun` flag, the terminal release outcome, release plans,
|
|
2646
|
+
* and package metadata. Omits unversioned release plans from the finalized
|
|
2647
|
+
* output.
|
|
2628
2648
|
*
|
|
2629
2649
|
* @param context Release execution context containing workflow state and plans
|
|
2630
2650
|
* @returns Structured release report object containing workflow results
|
|
2631
2651
|
*/
|
|
2632
2652
|
function generateReleaseReport(context) {
|
|
2633
2653
|
return {
|
|
2654
|
+
dryRun: context.dryRun,
|
|
2634
2655
|
outcome: context.outcome,
|
|
2635
2656
|
packages: context.packages.map((pkg) => ({
|
|
2636
2657
|
location: pkg.location,
|
|
@@ -2664,7 +2685,8 @@ function generateReleaseReport(context) {
|
|
|
2664
2685
|
*
|
|
2665
2686
|
* Logs the terminal outcome status and details for planned package releases.
|
|
2666
2687
|
* Displays package names, directories, and version changes on success, or
|
|
2667
|
-
* outputs the error message on failure.
|
|
2688
|
+
* outputs the error message on failure. Dry runs append a `(dry run)` marker
|
|
2689
|
+
* to the status line; real releases print the status unmarked.
|
|
2668
2690
|
*
|
|
2669
2691
|
* @param logger Logger instance for outputting messages
|
|
2670
2692
|
* @param report Release report containing outcome and package details
|
|
@@ -2675,7 +2697,7 @@ function printReleaseReport(logger, report) {
|
|
|
2675
2697
|
success: colors.green("SUCCESS"),
|
|
2676
2698
|
failure: colors.red("FAILURE")
|
|
2677
2699
|
}[report.outcome.status];
|
|
2678
|
-
logger.info(`Status: ${statusLabel}`);
|
|
2700
|
+
logger.info(`Status: ${[statusLabel, report.dryRun && colors.yellow("(dry run)")].filter(Boolean).join(" ")}`);
|
|
2679
2701
|
}
|
|
2680
2702
|
if (report.outcome?.status === "failure") return logger.error(["Release complete:", colors.red(resolveOutcomeErrorMessage(report.outcome))].join(" "));
|
|
2681
2703
|
if (report.plans.length === 0) return logger.info(["Release complete:", colors.yellow("No packages are scheduled for release.")].join(" "));
|
|
@@ -2721,68 +2743,97 @@ function printReleaseReportAnnotation(env, stdout, report) {
|
|
|
2721
2743
|
var formatAnnotationMessage = (message) => message.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
|
|
2722
2744
|
// src/workflow/executeReleaseWorkflow.ts
|
|
2723
2745
|
/**
|
|
2724
|
-
*
|
|
2746
|
+
* Resolve a plugin's hook entry into a normalized hook definition.
|
|
2725
2747
|
*
|
|
2726
|
-
* Normalizes the plugin's hook entry
|
|
2727
|
-
* handler
|
|
2728
|
-
*
|
|
2729
|
-
*
|
|
2730
|
-
*
|
|
2731
|
-
*
|
|
2748
|
+
* Normalizes the plugin's hook entry — a bare handler function or a
|
|
2749
|
+
* `{ priority, handler }` definition — and wraps the handler in shared timing
|
|
2750
|
+
* and logging middleware. When the wrapped handler throws, the failure is
|
|
2751
|
+
* attributed to the current hook and plugin on `context.outcome` before
|
|
2752
|
+
* rethrowing it. The `??=` assignment never overwrites a recorded outcome,
|
|
2753
|
+
* so `finalize` failures — which run after the outcome is recorded — leave it
|
|
2754
|
+
* unchanged.
|
|
2732
2755
|
*
|
|
2733
|
-
* @param
|
|
2734
|
-
* @param
|
|
2756
|
+
* @param hookName Name of the hook to resolve
|
|
2757
|
+
* @param plugin Plugin owning the hook entry
|
|
2758
|
+
* @returns Normalized hook definition, or `undefined` when the plugin does not
|
|
2759
|
+
* implement the hook
|
|
2735
2760
|
*/
|
|
2736
|
-
function
|
|
2737
|
-
const { hookName, plugin } = registration;
|
|
2761
|
+
function resolvePluginHook(hookName, plugin) {
|
|
2738
2762
|
let hook = plugin[hookName];
|
|
2739
2763
|
if (typeof hook === "function") hook = { handler: hook };
|
|
2740
2764
|
const handler = hook?.handler;
|
|
2741
2765
|
const priority = hook?.priority;
|
|
2742
2766
|
if (!handler) return;
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
const
|
|
2767
|
+
return {
|
|
2768
|
+
priority,
|
|
2769
|
+
handler: async (context, next) => {
|
|
2770
|
+
const current = {
|
|
2771
|
+
hook: hookName,
|
|
2772
|
+
plugin: plugin.name
|
|
2773
|
+
};
|
|
2774
|
+
const label = `${colors.gray(`[${current.hook}]`)} ${current.plugin}`;
|
|
2775
|
+
let startedLogging = false;
|
|
2776
|
+
let hasError = false;
|
|
2777
|
+
startedLogging = true;
|
|
2778
|
+
context.logger.start(label);
|
|
2779
|
+
const currentFrame = { startTime: performance.now() };
|
|
2780
|
+
const nextFrame = { duration: 0 };
|
|
2781
|
+
const runNext = async () => {
|
|
2782
|
+
const startTime = performance.now();
|
|
2783
|
+
try {
|
|
2784
|
+
return await next(context);
|
|
2785
|
+
} finally {
|
|
2786
|
+
nextFrame.duration = performance.now() - startTime;
|
|
2787
|
+
}
|
|
2788
|
+
};
|
|
2757
2789
|
try {
|
|
2758
|
-
return await
|
|
2790
|
+
return await handler.call(plugin, context, runNext);
|
|
2791
|
+
} catch (err) {
|
|
2792
|
+
hasError = true;
|
|
2793
|
+
context.outcome ??= {
|
|
2794
|
+
status: "failure",
|
|
2795
|
+
error: err,
|
|
2796
|
+
phase: current
|
|
2797
|
+
};
|
|
2798
|
+
throw err;
|
|
2759
2799
|
} finally {
|
|
2760
|
-
|
|
2800
|
+
if (startedLogging) {
|
|
2801
|
+
const duration = performance.now() - currentFrame.startTime - nextFrame.duration;
|
|
2802
|
+
const message = [label, (duration >= 5e3 ? colors.yellow : colors.cyan)(`${(duration / 1e3).toFixed(2)}s`)].join(" ");
|
|
2803
|
+
if (hasError) context.logger.error(message);
|
|
2804
|
+
else context.logger.success(message);
|
|
2805
|
+
}
|
|
2761
2806
|
}
|
|
2762
|
-
}
|
|
2807
|
+
}
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
/**
|
|
2811
|
+
* Wrap a hook handler so a thrown error is recorded before rethrowing.
|
|
2812
|
+
*
|
|
2813
|
+
* Each recorded failure keeps the owning hook and plugin. The hook manager
|
|
2814
|
+
* middleware rescues rethrown `finalize` errors so the remaining
|
|
2815
|
+
* `finalize` handlers still run; other hook errors keep the fail-fast
|
|
2816
|
+
* unwinding behavior.
|
|
2817
|
+
*
|
|
2818
|
+
* @param handler Hook handler to wrap
|
|
2819
|
+
* @param hookName Name of the hook the handler is registered for
|
|
2820
|
+
* @param plugin Plugin owning the hook handler
|
|
2821
|
+
* @param failures Array of recorded handler failures
|
|
2822
|
+
* @returns Wrapped hook handler
|
|
2823
|
+
*/
|
|
2824
|
+
function wrapHandlerWithFailureCollection(handler, hookName, plugin, failures) {
|
|
2825
|
+
return async (context, next) => {
|
|
2763
2826
|
try {
|
|
2764
|
-
return await handler
|
|
2765
|
-
} catch (
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
}
|
|
2771
|
-
|
|
2772
|
-
status: "failure",
|
|
2773
|
-
error: err,
|
|
2774
|
-
phase: current
|
|
2775
|
-
};
|
|
2776
|
-
throw err;
|
|
2777
|
-
} finally {
|
|
2778
|
-
if (startedLogging) {
|
|
2779
|
-
const duration = performance.now() - currentFrame.startTime - nextFrame.duration;
|
|
2780
|
-
const message = [label, (duration >= 5e3 ? colors.yellow : colors.cyan)(`${(duration / 1e3).toFixed(2)}s`)].join(" ");
|
|
2781
|
-
if (hasError) context.logger.error(message);
|
|
2782
|
-
else context.logger.success(message);
|
|
2783
|
-
}
|
|
2827
|
+
return await handler(context, next);
|
|
2828
|
+
} catch (error) {
|
|
2829
|
+
failures.push({
|
|
2830
|
+
hook: hookName,
|
|
2831
|
+
plugin: plugin.name,
|
|
2832
|
+
error
|
|
2833
|
+
});
|
|
2834
|
+
throw error;
|
|
2784
2835
|
}
|
|
2785
|
-
}
|
|
2836
|
+
};
|
|
2786
2837
|
}
|
|
2787
2838
|
/**
|
|
2788
2839
|
* Throw a cancellation error when the context abort signal has fired.
|
|
@@ -2811,9 +2862,10 @@ function throwIfCancelled(context) {
|
|
|
2811
2862
|
* send notifications and clean up: when a phase hook throws, plugin rollbacks
|
|
2812
2863
|
* run while the error unwinds, then every `finalize` handler runs with the
|
|
2813
2864
|
* failure recorded on `context.outcome`. When a `finalize` handler throws,
|
|
2814
|
-
* the
|
|
2815
|
-
*
|
|
2816
|
-
*
|
|
2865
|
+
* the hook manager middleware rescues the error so the remaining handlers
|
|
2866
|
+
* still run, and each `finalize` failure is logged as a warning after the
|
|
2867
|
+
* report. A failing `finalize` handler never changes the workflow outcome
|
|
2868
|
+
* and never masks the original workflow error.
|
|
2817
2869
|
*
|
|
2818
2870
|
* @param context Release execution context containing runtime options and logger
|
|
2819
2871
|
* @param plugins List of release plugins to execute
|
|
@@ -2822,16 +2874,26 @@ function throwIfCancelled(context) {
|
|
|
2822
2874
|
* @throws If a lifecycle hook fails or the workflow is cancelled
|
|
2823
2875
|
*/
|
|
2824
2876
|
async function executeReleaseWorkflow(context, plugins) {
|
|
2825
|
-
const phaseHookNames = RELEASE_HOOK_NAMES.filter((name) => name !== "finalize");
|
|
2826
2877
|
context.outcome = null;
|
|
2827
|
-
const
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2878
|
+
const handlerFailures = [];
|
|
2879
|
+
const manager = new HookManager(async (context, registration, next) => {
|
|
2880
|
+
if (registration.name !== "finalize") return registration.handler(context, next);
|
|
2881
|
+
try {
|
|
2882
|
+
return await registration.handler(context, next);
|
|
2883
|
+
} catch {
|
|
2884
|
+
return next(context);
|
|
2885
|
+
}
|
|
2831
2886
|
});
|
|
2887
|
+
for (const hookName of RELEASE_HOOK_NAMES) for (const plugin of plugins) {
|
|
2888
|
+
const definition = resolvePluginHook(hookName, plugin);
|
|
2889
|
+
if (!definition) continue;
|
|
2890
|
+
const handler = wrapHandlerWithFailureCollection(definition.handler, hookName, plugin, handlerFailures);
|
|
2891
|
+
manager.on(hookName, handler, definition.priority);
|
|
2892
|
+
}
|
|
2832
2893
|
const dispatch = async (index, context) => {
|
|
2833
|
-
const hook =
|
|
2894
|
+
const hook = RELEASE_HOOK_NAMES[index];
|
|
2834
2895
|
if (!hook) return;
|
|
2896
|
+
if (hook === "finalize") return await dispatch(index + 1, context);
|
|
2835
2897
|
throwIfCancelled(context);
|
|
2836
2898
|
return await manager.emit(hook, context, (context) => dispatch(index + 1, context));
|
|
2837
2899
|
};
|
|
@@ -2849,21 +2911,13 @@ async function executeReleaseWorkflow(context, plugins) {
|
|
|
2849
2911
|
phase: null
|
|
2850
2912
|
};
|
|
2851
2913
|
}
|
|
2852
|
-
const finalizeFailures = [];
|
|
2853
|
-
for (const plugin of plugins) registerPluginHook(manager, {
|
|
2854
|
-
hookName: "finalize",
|
|
2855
|
-
plugin,
|
|
2856
|
-
onHandlerError: (error) => finalizeFailures.push({
|
|
2857
|
-
plugin: plugin.name,
|
|
2858
|
-
error
|
|
2859
|
-
})
|
|
2860
|
-
});
|
|
2861
2914
|
await manager.emit("finalize", context);
|
|
2862
2915
|
const report = generateReleaseReport(context);
|
|
2863
2916
|
printReleaseReport(context.logger, report);
|
|
2864
2917
|
appendReleaseReportSummary(context.logger, context.env, report);
|
|
2865
2918
|
printReleaseReportAnnotation(context.env, context.stdout, report);
|
|
2866
|
-
for (const failure of
|
|
2919
|
+
for (const failure of handlerFailures) {
|
|
2920
|
+
if (failure.hook !== "finalize") continue;
|
|
2867
2921
|
if (failure.error === context.outcome.error) continue;
|
|
2868
2922
|
context.logger.warn(`Plugin "${failure.plugin}" could not finalize: ${failure.error instanceof Error ? failure.error.message : String(failure.error)}`);
|
|
2869
2923
|
}
|
|
@@ -2871,4 +2925,4 @@ async function executeReleaseWorkflow(context, plugins) {
|
|
|
2871
2925
|
}
|
|
2872
2926
|
export { isGitShallowRepository as $, getGitTagMessage as A, execGit as At, getGitRemote as B, SEMVER_REGEX as Bt, iterateChangelogVersions as C, readJson as Ct, isGitTagExact as D, isTruthyString as Dt, buildDependencyGraph as E, isClass as Et, deleteGitTag as F, ALL_FILES as Ft, readGitHistory as G, pickPriorityReleaseType as Gt, getGitConfigValue as H, isStableVersion as Ht, createGitTag as I, DEFAULT_CHANGELOG_FILE as It, detectGitRelationship as J, extractVersionQualifier as Jt, mergeGitHistory as K, deriveCommitReleaseType as Kt, readGitFile as L, DEV_NULL as Lt, generateGitTagName as M, compact as Mt, ensureGitTag as N, isDefined as Nt, isGitTagConnected as O, interpolate as Ot, isGitTagPresent as P, buildTrailerPattern as Pt, withShallowLock as Q, resolveGitRepository as R, GIT_TRAILER_RELEASE_AGENT as Rt, extractLatestVersion as S, unique as St, extractPlainText as T, isGitHubActions as Tt, restoreFullGitHistory as U, isSameReleaseCycle as Ut, ensureGitUserConfig as V, promotePrereleaseVersions as Vt, readParsedGitHistory as W, deriveReleaseType as Wt, resolveGitRevision as X, expandGitHistory as Y, isGitAncestor as Z, resolvePackageTag as _, isSemVerGitTag as _t, appendReleaseReportSummary as a, parseGitPrettyFormat as at, discoverPackageTag as b, createPlugin as bt, generateReleaseCommitMessage as c, extractMentions as ct, prependChangelog as d, deriveTransitionReleases as dt, countGitHistory as et, extractPreviousVersion as f, deriveChangeReleases as ft, propagateDependencyUpdates as g, sanitizePrereleaseLabel as gt, readPackageHistory as h, resolveReleaseChannel as ht, generateReleaseReport as i, GIT_PRETTY_FORMAT as it, getCurrentGitTag as j, execCommand as jt, getLatestGitTag as k, formatFile as kt, version as l, createGitCommit as lt, buildChangelog as m, resolveVersionQualifier as mt, printReleaseReportAnnotation as n, getParsedGitCommit as nt, HookManager as o, parseGitCommit as ot, buildReleaseNotes as p, packageContainsCommit as pt, GIT_REL_FLAGS as q, bumpVersion as qt, printReleaseReport as r, GIT_PRETTY_FIELD_SEPARATOR as rt, HookPriority as s, TTLCache as st, executeReleaseWorkflow as t, getCurrentGitCommit as tt, writeChangelog as u, getCurrentGitBranch as ut, resolvePackageStableTag as v, isSemVer as vt, extractSemVer as w, isMatch as wt, verifyPackageTag as x, writeJson as xt, filterPackages as y, findReleaseRule as yt, pushGitChanges as z, RELEASE_HOOK_NAMES as zt };
|
|
2873
2927
|
|
|
2874
|
-
//# sourceMappingURL=workflow-
|
|
2928
|
+
//# sourceMappingURL=workflow-Dk-fKaAx.js.map
|