@reelout/core 0.8.0 → 0.9.1
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-MQRNVoZo.js → workflow-jcFymxIW.js} +182 -81
- package/dist/workflow-jcFymxIW.js.map +1 -0
- package/package.json +1 -1
- package/src/types.ts +15 -6
- package/src/workflow/executeReleaseWorkflow.ts +222 -100
- package/src/workflow/report/appendReleaseReportSummary.ts +6 -6
- package/src/workflow/report/generateReleaseReport.ts +3 -9
- package/src/workflow/report/printReleaseReport.ts +9 -11
- package/src/workflow/report/printReleaseReportAnnotation.ts +4 -3
- package/src/workflow/report/resolveErrorMessage.ts +36 -0
- package/dist/workflow-MQRNVoZo.js.map +0 -1
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-jcFymxIW.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-jcFymxIW.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-jcFymxIW.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-jcFymxIW.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.9.0";
|
|
2388
2388
|
// src/workflow/commit/generateReleaseCommitMessage.ts
|
|
2389
2389
|
var NOTABLE_TYPES = [
|
|
2390
2390
|
"feat",
|
|
@@ -2527,6 +2527,34 @@ var HookManager = class {
|
|
|
2527
2527
|
return await dispatch(0, context);
|
|
2528
2528
|
}
|
|
2529
2529
|
};
|
|
2530
|
+
// src/workflow/report/resolveErrorMessage.ts
|
|
2531
|
+
/**
|
|
2532
|
+
* Resolve a displayable message from an unknown error value.
|
|
2533
|
+
*
|
|
2534
|
+
* Normalizes `Error` instances to their `message` and passes string values
|
|
2535
|
+
* through unchanged. Returns `null` for any other shape so callers can fall
|
|
2536
|
+
* back to a generic message.
|
|
2537
|
+
*
|
|
2538
|
+
* @param error Unknown error value carried on a release outcome
|
|
2539
|
+
* @returns The resolved error message, or `null` when none can be resolved
|
|
2540
|
+
*/
|
|
2541
|
+
function resolveErrorMessage(error) {
|
|
2542
|
+
if (Error.isError(error)) return error.message;
|
|
2543
|
+
return typeof error === "string" ? error : null;
|
|
2544
|
+
}
|
|
2545
|
+
var FALLBACK_ERROR_MESSAGE = "An unexpected error occurred during the release process.";
|
|
2546
|
+
/**
|
|
2547
|
+
* Resolve a displayable failure message from a release outcome.
|
|
2548
|
+
*
|
|
2549
|
+
* Normalizes the outcome error to its message and falls back to a generic
|
|
2550
|
+
* message when the error carries no displayable content.
|
|
2551
|
+
*
|
|
2552
|
+
* @param outcome Failure outcome whose error is rendered
|
|
2553
|
+
* @returns The resolved error message, or the fallback message
|
|
2554
|
+
*/
|
|
2555
|
+
function resolveOutcomeErrorMessage(outcome) {
|
|
2556
|
+
return resolveErrorMessage(outcome.error) || FALLBACK_ERROR_MESSAGE;
|
|
2557
|
+
}
|
|
2530
2558
|
// src/workflow/report/appendReleaseReportSummary.ts
|
|
2531
2559
|
var STATUS_LABELS = {
|
|
2532
2560
|
success: "Success",
|
|
@@ -2543,7 +2571,7 @@ var STATUS_LABELS = {
|
|
|
2543
2571
|
*
|
|
2544
2572
|
* @param logger Logger instance for reporting summary write failures
|
|
2545
2573
|
* @param env Readonly process environment variables object
|
|
2546
|
-
* @param report Release report containing
|
|
2574
|
+
* @param report Release report containing outcome and package details
|
|
2547
2575
|
*/
|
|
2548
2576
|
function appendReleaseReportSummary(logger, env, report) {
|
|
2549
2577
|
if (!isGitHubActions(env)) return;
|
|
@@ -2561,9 +2589,9 @@ var formatPackageLabel = (plan) => {
|
|
|
2561
2589
|
};
|
|
2562
2590
|
var formatReleaseReportSummary = (report) => {
|
|
2563
2591
|
const lines = ["## ReelOut Release Report", ""];
|
|
2564
|
-
if (report.
|
|
2565
|
-
if (report.status === "failure") {
|
|
2566
|
-
const message = report.
|
|
2592
|
+
if (report.outcome) lines.push(`**Status:** ${STATUS_LABELS[report.outcome.status]}`, "");
|
|
2593
|
+
if (report.outcome?.status === "failure") {
|
|
2594
|
+
const message = resolveOutcomeErrorMessage(report.outcome);
|
|
2567
2595
|
lines.push(...message.split("\n").map((line) => `> ${line}`), "");
|
|
2568
2596
|
return lines.join("\n");
|
|
2569
2597
|
}
|
|
@@ -2595,17 +2623,15 @@ var formatReleaseReportSummary = (report) => {
|
|
|
2595
2623
|
* Generate a structured release report from the current workflow state.
|
|
2596
2624
|
*
|
|
2597
2625
|
* Extracts state information from `context` and organizes it into a report
|
|
2598
|
-
* containing
|
|
2599
|
-
* unversioned release plans from the finalized output.
|
|
2626
|
+
* containing the terminal release outcome, release plans, and package
|
|
2627
|
+
* metadata. Omits unversioned release plans from the finalized output.
|
|
2600
2628
|
*
|
|
2601
2629
|
* @param context Release execution context containing workflow state and plans
|
|
2602
2630
|
* @returns Structured release report object containing workflow results
|
|
2603
2631
|
*/
|
|
2604
2632
|
function generateReleaseReport(context) {
|
|
2605
2633
|
return {
|
|
2606
|
-
|
|
2607
|
-
phase: context.phase,
|
|
2608
|
-
error: Error.isError(context.error) ? context.error.message : typeof context.error === "string" ? context.error : null,
|
|
2634
|
+
outcome: context.outcome,
|
|
2609
2635
|
packages: context.packages.map((pkg) => ({
|
|
2610
2636
|
location: pkg.location,
|
|
2611
2637
|
name: pkg.name,
|
|
@@ -2636,22 +2662,22 @@ function generateReleaseReport(context) {
|
|
|
2636
2662
|
/**
|
|
2637
2663
|
* Print a formatted release report to the logger.
|
|
2638
2664
|
*
|
|
2639
|
-
* Logs
|
|
2640
|
-
* package names, directories, and version changes on success, or
|
|
2641
|
-
* error message on failure.
|
|
2665
|
+
* Logs the terminal outcome status and details for planned package releases.
|
|
2666
|
+
* Displays package names, directories, and version changes on success, or
|
|
2667
|
+
* outputs the error message on failure.
|
|
2642
2668
|
*
|
|
2643
2669
|
* @param logger Logger instance for outputting messages
|
|
2644
|
-
* @param report Release report containing
|
|
2670
|
+
* @param report Release report containing outcome and package details
|
|
2645
2671
|
*/
|
|
2646
2672
|
function printReleaseReport(logger, report) {
|
|
2647
|
-
if (report.
|
|
2673
|
+
if (report.outcome) {
|
|
2648
2674
|
const statusLabel = {
|
|
2649
2675
|
success: colors.green("SUCCESS"),
|
|
2650
2676
|
failure: colors.red("FAILURE")
|
|
2651
|
-
}[report.status];
|
|
2677
|
+
}[report.outcome.status];
|
|
2652
2678
|
logger.info(`Status: ${statusLabel}`);
|
|
2653
2679
|
}
|
|
2654
|
-
if (report.status === "failure") return logger.error(["Release complete:", colors.red(report.
|
|
2680
|
+
if (report.outcome?.status === "failure") return logger.error(["Release complete:", colors.red(resolveOutcomeErrorMessage(report.outcome))].join(" "));
|
|
2655
2681
|
if (report.plans.length === 0) return logger.info(["Release complete:", colors.yellow("No packages are scheduled for release.")].join(" "));
|
|
2656
2682
|
const header = [
|
|
2657
2683
|
"Release complete:",
|
|
@@ -2685,89 +2711,164 @@ function printReleaseReport(logger, report) {
|
|
|
2685
2711
|
*
|
|
2686
2712
|
* @param env Readonly process environment variables object
|
|
2687
2713
|
* @param stdout Writable stream receiving the annotation command
|
|
2688
|
-
* @param report Release report containing
|
|
2714
|
+
* @param report Release report containing outcome and failure details
|
|
2689
2715
|
*/
|
|
2690
2716
|
function printReleaseReportAnnotation(env, stdout, report) {
|
|
2691
|
-
if (!isGitHubActions(env) || report.status !== "failure") return;
|
|
2692
|
-
const message = formatAnnotationMessage(report.
|
|
2717
|
+
if (!isGitHubActions(env) || report.outcome?.status !== "failure") return;
|
|
2718
|
+
const message = formatAnnotationMessage(resolveOutcomeErrorMessage(report.outcome));
|
|
2693
2719
|
stdout.write(`::error title=Release failed::${message}\n`);
|
|
2694
2720
|
}
|
|
2695
2721
|
var formatAnnotationMessage = (message) => message.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
|
|
2696
2722
|
// src/workflow/executeReleaseWorkflow.ts
|
|
2697
2723
|
/**
|
|
2724
|
+
* Register a plugin's hook handler on the workflow hook manager.
|
|
2725
|
+
*
|
|
2726
|
+
* Normalizes the plugin's hook entry into a handler and priority, wraps the
|
|
2727
|
+
* handler in shared timing and logging middleware, and registers it under
|
|
2728
|
+
* the registration's hook name. When `onHandlerError` is provided, a thrown
|
|
2729
|
+
* handler error is passed to it and the middleware chain continues so later
|
|
2730
|
+
* handlers still run; without it the wrapper attributes the failure to the
|
|
2731
|
+
* current hook and plugin on `context.outcome` before rethrowing.
|
|
2732
|
+
*
|
|
2733
|
+
* @param manager Hook manager receiving the wrapped handler
|
|
2734
|
+
* @param registration Plugin hook registration carrying the error strategy
|
|
2735
|
+
*/
|
|
2736
|
+
function registerPluginHook(manager, registration) {
|
|
2737
|
+
const { hookName, plugin } = registration;
|
|
2738
|
+
let hook = plugin[hookName];
|
|
2739
|
+
if (typeof hook === "function") hook = { handler: hook };
|
|
2740
|
+
const handler = hook?.handler;
|
|
2741
|
+
const priority = hook?.priority;
|
|
2742
|
+
if (!handler) return;
|
|
2743
|
+
manager.on(hookName, async (context, next) => {
|
|
2744
|
+
const current = {
|
|
2745
|
+
hook: hookName,
|
|
2746
|
+
plugin: plugin.name
|
|
2747
|
+
};
|
|
2748
|
+
const label = `${colors.gray(`[${current.hook}]`)} ${current.plugin}`;
|
|
2749
|
+
let startedLogging = false;
|
|
2750
|
+
let hasError = false;
|
|
2751
|
+
startedLogging = true;
|
|
2752
|
+
context.logger.start(label);
|
|
2753
|
+
const currentFrame = { startTime: performance.now() };
|
|
2754
|
+
const nextFrame = { duration: 0 };
|
|
2755
|
+
const runNext = async () => {
|
|
2756
|
+
const startTime = performance.now();
|
|
2757
|
+
try {
|
|
2758
|
+
return await next(context);
|
|
2759
|
+
} finally {
|
|
2760
|
+
nextFrame.duration = performance.now() - startTime;
|
|
2761
|
+
}
|
|
2762
|
+
};
|
|
2763
|
+
try {
|
|
2764
|
+
return await handler.call(plugin, context, runNext);
|
|
2765
|
+
} catch (err) {
|
|
2766
|
+
hasError = true;
|
|
2767
|
+
if (registration.onHandlerError) {
|
|
2768
|
+
registration.onHandlerError(err);
|
|
2769
|
+
return await runNext();
|
|
2770
|
+
}
|
|
2771
|
+
context.outcome ??= {
|
|
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
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
}, priority);
|
|
2786
|
+
}
|
|
2787
|
+
/**
|
|
2788
|
+
* Throw a cancellation error when the context abort signal has fired.
|
|
2789
|
+
*
|
|
2790
|
+
* Wraps the underlying `AbortError` so the workflow reports a readable
|
|
2791
|
+
* cancellation instead of a bare DOM exception.
|
|
2792
|
+
*
|
|
2793
|
+
* @param context Release execution context carrying the optional abort signal
|
|
2794
|
+
* @throws If the context abort signal has already fired
|
|
2795
|
+
*/
|
|
2796
|
+
function throwIfCancelled(context) {
|
|
2797
|
+
const signal = context.signal;
|
|
2798
|
+
if (!signal?.aborted) return;
|
|
2799
|
+
try {
|
|
2800
|
+
signal.throwIfAborted();
|
|
2801
|
+
} catch (err) {
|
|
2802
|
+
throw new Error("Release cancelled.", { cause: err });
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
/**
|
|
2698
2806
|
* Execute the complete release workflow across all configured plugins.
|
|
2699
2807
|
*
|
|
2700
2808
|
* Runs each lifecycle phase sequentially, dispatching plugin hooks in onion
|
|
2701
|
-
* order based on declared priority
|
|
2702
|
-
*
|
|
2809
|
+
* order based on declared priority, and checks the abort signal before each
|
|
2810
|
+
* phase. Emits the `finalize` hook on every terminal outcome so plugins can
|
|
2811
|
+
* send notifications and clean up: when a phase hook throws, plugin rollbacks
|
|
2812
|
+
* run while the error unwinds, then every `finalize` handler runs with the
|
|
2813
|
+
* failure recorded on `context.outcome`. When a `finalize` handler throws,
|
|
2814
|
+
* the remaining handlers still run and each failure is logged as a warning
|
|
2815
|
+
* after the report. A failing `finalize` handler never changes the workflow
|
|
2816
|
+
* outcome and never masks the original workflow error.
|
|
2703
2817
|
*
|
|
2704
2818
|
* @param context Release execution context containing runtime options and logger
|
|
2705
2819
|
* @param plugins List of release plugins to execute
|
|
2706
|
-
* @returns Promise that resolves when all
|
|
2707
|
-
*
|
|
2820
|
+
* @returns Promise that resolves when all phases and `finalize` handlers
|
|
2821
|
+
* complete
|
|
2822
|
+
* @throws If a lifecycle hook fails or the workflow is cancelled
|
|
2708
2823
|
*/
|
|
2709
2824
|
async function executeReleaseWorkflow(context, plugins) {
|
|
2825
|
+
const phaseHookNames = RELEASE_HOOK_NAMES.filter((name) => name !== "finalize");
|
|
2826
|
+
context.outcome = null;
|
|
2827
|
+
const manager = new HookManager();
|
|
2828
|
+
for (const hookName of phaseHookNames) for (const plugin of plugins) registerPluginHook(manager, {
|
|
2829
|
+
hookName,
|
|
2830
|
+
plugin
|
|
2831
|
+
});
|
|
2832
|
+
const dispatch = async (index, context) => {
|
|
2833
|
+
const hook = phaseHookNames[index];
|
|
2834
|
+
if (!hook) return;
|
|
2835
|
+
throwIfCancelled(context);
|
|
2836
|
+
return await manager.emit(hook, context, (context) => dispatch(index + 1, context));
|
|
2837
|
+
};
|
|
2710
2838
|
try {
|
|
2711
|
-
context.status = null;
|
|
2712
|
-
context.error = null;
|
|
2713
|
-
const manager = new HookManager();
|
|
2714
|
-
for (const hookName of RELEASE_HOOK_NAMES) for (const plugin of plugins) {
|
|
2715
|
-
let hook = plugin[hookName];
|
|
2716
|
-
if (typeof hook === "function") hook = { handler: hook };
|
|
2717
|
-
const handler = hook?.handler;
|
|
2718
|
-
const priority = hook?.priority;
|
|
2719
|
-
if (handler) manager.on(hookName, async (context, next) => {
|
|
2720
|
-
const current = context.phase = {
|
|
2721
|
-
hook: hookName,
|
|
2722
|
-
plugin: plugin.name
|
|
2723
|
-
};
|
|
2724
|
-
const label = `${colors.gray(`[${current.hook}]`)} ${current.plugin}`;
|
|
2725
|
-
let startedLogging = false;
|
|
2726
|
-
let hasError = false;
|
|
2727
|
-
startedLogging = true;
|
|
2728
|
-
context.logger.start(label);
|
|
2729
|
-
const currentFrame = { startTime: performance.now() };
|
|
2730
|
-
const nextFrame = { duration: 0 };
|
|
2731
|
-
try {
|
|
2732
|
-
return await handler.call(plugin, context, async () => {
|
|
2733
|
-
const startTime = performance.now();
|
|
2734
|
-
try {
|
|
2735
|
-
return await next(context);
|
|
2736
|
-
} finally {
|
|
2737
|
-
nextFrame.duration = performance.now() - startTime;
|
|
2738
|
-
}
|
|
2739
|
-
});
|
|
2740
|
-
} catch (err) {
|
|
2741
|
-
hasError = true;
|
|
2742
|
-
throw err;
|
|
2743
|
-
} finally {
|
|
2744
|
-
if (startedLogging) {
|
|
2745
|
-
const duration = performance.now() - currentFrame.startTime - nextFrame.duration;
|
|
2746
|
-
const message = [label, (duration >= 5e3 ? colors.yellow : colors.cyan)(`${(duration / 1e3).toFixed(2)}s`)].join(" ");
|
|
2747
|
-
if (hasError) context.logger.error(message);
|
|
2748
|
-
else context.logger.success(message);
|
|
2749
|
-
}
|
|
2750
|
-
}
|
|
2751
|
-
}, priority);
|
|
2752
|
-
}
|
|
2753
|
-
const dispatch = async (index, context) => {
|
|
2754
|
-
const hook = RELEASE_HOOK_NAMES[index];
|
|
2755
|
-
if (!hook) return;
|
|
2756
|
-
return await manager.emit(hook, context, (context) => dispatch(index + 1, context));
|
|
2757
|
-
};
|
|
2758
2839
|
await dispatch(0, context);
|
|
2759
|
-
context.
|
|
2840
|
+
context.outcome = {
|
|
2841
|
+
status: "success",
|
|
2842
|
+
error: null,
|
|
2843
|
+
phase: null
|
|
2844
|
+
};
|
|
2760
2845
|
} catch (err) {
|
|
2761
|
-
context.
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2846
|
+
context.outcome ??= {
|
|
2847
|
+
status: "failure",
|
|
2848
|
+
error: err,
|
|
2849
|
+
phase: null
|
|
2850
|
+
};
|
|
2851
|
+
}
|
|
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
|
+
await manager.emit("finalize", context);
|
|
2862
|
+
const report = generateReleaseReport(context);
|
|
2863
|
+
printReleaseReport(context.logger, report);
|
|
2864
|
+
appendReleaseReportSummary(context.logger, context.env, report);
|
|
2865
|
+
printReleaseReportAnnotation(context.env, context.stdout, report);
|
|
2866
|
+
for (const failure of finalizeFailures) {
|
|
2867
|
+
if (failure.error === context.outcome.error) continue;
|
|
2868
|
+
context.logger.warn(`Plugin "${failure.plugin}" could not finalize: ${failure.error instanceof Error ? failure.error.message : String(failure.error)}`);
|
|
2769
2869
|
}
|
|
2870
|
+
if (context.outcome.status === "failure") throw context.outcome.error;
|
|
2770
2871
|
}
|
|
2771
2872
|
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 };
|
|
2772
2873
|
|
|
2773
|
-
//# sourceMappingURL=workflow-
|
|
2874
|
+
//# sourceMappingURL=workflow-jcFymxIW.js.map
|