shiplane 0.5.1 → 0.5.2

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.
@@ -1,4 +1,4 @@
1
- import { a as releaseFlow, c as findUnset, i as backendService, l as isEnvVarName, n as publishedPackage, o as ENV_VAR_NAME, r as mobileApp, s as EnvToCheck, t as webApp } from "./web-app.module-Cg3SYqSo.js";
1
+ import { a as releaseFlow, c as findUnset, i as backendService, l as isEnvVarName, n as publishedPackage, o as ENV_VAR_NAME, r as mobileApp, s as EnvToCheck, t as webApp } from "./web-app.module-BB1fY1Kd.js";
2
2
  import { A as workspacePatterns, C as changelogSection, D as tagFormatNamed, E as releaseTags, O as tagName, S as cameWithRelease, _ as nextVersion, a as CommandFailed, b as DEFAULT_TAG_FORMAT, c as onlyVersionFiles, d as appBumps, f as changesetApps, i as minutesBudget, k as expandPatterns, l as shipsFrom, m as splitChangesets, o as deployRunTitle, p as packageBumps, r as deployEstimate, u as webShip, v as releaseSource, w as firstRelease, x as TAG_FORMATS } from "./budget-BTnKtGF6.js";
3
3
  import { z } from "zod";
4
4
  import fs from "node:fs";
@@ -2390,9 +2390,12 @@ const previewChoice = ({ version, changesets, tagged, versioned, firstRelease, o
2390
2390
  pending: false,
2391
2391
  hint: `${version} released, nothing deploys it`
2392
2392
  };
2393
- if (decidedBy) return {
2393
+ if (decidedBy) return onChannel ? {
2394
2394
  pending: false,
2395
2395
  hint: `${version} released, nothing new (${decidedBy.check} shows its builds)`
2396
+ } : {
2397
+ pending: true,
2398
+ hint: `${version} tagged, never reached preview: retry`
2396
2399
  };
2397
2400
  const where = noEnvironment ? "live" : "on preview";
2398
2401
  return onChannel ? {
@@ -2602,6 +2605,18 @@ const askPaths = async (context, environment, shipments) => {
2602
2605
  return paths;
2603
2606
  };
2604
2607
  //#endregion
2608
+ //#region src/application/mapLimit.ts
2609
+ /** Runs `work` on every item, at most `limit` at once; results in input order, rejects like Promise.all. */
2610
+ const mapLimit = async (items, limit, work) => {
2611
+ const results = new Array(items.length);
2612
+ const queue = items.entries();
2613
+ const worker = async () => {
2614
+ for (const [index, item] of queue) results[index] = await work(item, index);
2615
+ };
2616
+ await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
2617
+ return results;
2618
+ };
2619
+ //#endregion
2605
2620
  //#region src/application/waitForMerge.ts
2606
2621
  const POLL_MS = 15e3;
2607
2622
  /** Merges the pull request with the method the person picks. GitHub refuses approving your own PR. */
@@ -2783,20 +2798,28 @@ const chosen = async (context, choice) => {
2783
2798
  status: choice.held
2784
2799
  };
2785
2800
  };
2801
+ /** Units checked at once: their platforms answer slowly, each on its own. */
2802
+ const CHECKS_AT_ONCE = 4;
2786
2803
  /**
2787
- * What every picked unit needs on the environment, in dispatch order, said as it goes. A module may
2788
- * first need a small PR merged (a version moving): it opens, merges, and the module decides again.
2789
- * Null when one of them refused.
2804
+ * What every picked unit needs on the environment, in dispatch order, said as it goes. Every unit is
2805
+ * checked at once, then each is settled in order. A module may first need a small PR merged (a
2806
+ * version moving): it opens, merges, and that unit and every one after it decide again. Null when
2807
+ * one of them refused.
2790
2808
  */
2791
2809
  const decideAll = async (context, environment, scope) => {
2792
2810
  const { release, services, output } = context;
2793
2811
  const recorded = await services.codeHost.deployments().catch(() => []);
2794
- const ready = [];
2795
- for (const unit of release.units) {
2812
+ const picked = release.units.flatMap((unit) => {
2796
2813
  const module = moduleOf(context, unit);
2797
- if (scope && !scope.has(unit.name) || !module) continue;
2798
- const tag = tagName(unit.name, unit.version, context.release.tagFormat);
2799
- if (!module.decide && !await services.sourceControl.tagCommit(tag)) continue;
2814
+ if (scope && !scope.has(unit.name) || !module) return [];
2815
+ return [{
2816
+ unit,
2817
+ module,
2818
+ tag: tagName(unit.name, unit.version, context.release.tagFormat)
2819
+ }];
2820
+ });
2821
+ const tagged = await mapLimit(picked, CHECKS_AT_ONCE, async ({ module, tag }) => module.decide !== void 0 || await services.sourceControl.tagCommit(tag) !== null);
2822
+ const units = picked.filter((_, index) => tagged[index]).map(({ unit, module, tag }) => {
2800
2823
  const decide = async () => {
2801
2824
  const { head } = await services.sourceControl.position();
2802
2825
  const input = jobInput(context, module, unit, {
@@ -2810,7 +2833,34 @@ const decideAll = async (context, environment, scope) => {
2810
2833
  };
2811
2834
  };
2812
2835
  const checked = module.kind === "published-package" ? module.provider : environment;
2813
- let { input, decision } = await context.progress.during(module.releaseOnly ? `Checking what ${tag} needs` : `Checking what ${tag} needs on ${checked}`, "thinking", decide);
2836
+ return {
2837
+ unit,
2838
+ module,
2839
+ tag,
2840
+ decide,
2841
+ label: module.releaseOnly ? `Checking what ${tag} needs` : `Checking what ${tag} needs on ${checked}`,
2842
+ on: module.releaseOnly ? null : checked
2843
+ };
2844
+ });
2845
+ const [only] = units;
2846
+ const places = new Set(units.map(({ on }) => on));
2847
+ const [place] = places;
2848
+ const batchLabel = `Checking what ${units.length} units need${places.size === 1 && place ? ` on ${place}` : ""}`;
2849
+ let done = 0;
2850
+ const firstLook = !only ? [] : units.length === 1 ? [await context.progress.during(only.label, "thinking", only.decide)] : await context.progress.during(batchLabel, "thinking", () => mapLimit(units, CHECKS_AT_ONCE, async ({ decide }) => {
2851
+ const result = await decide();
2852
+ done += 1;
2853
+ return result;
2854
+ }), {
2855
+ done: () => done,
2856
+ total: units.length
2857
+ });
2858
+ const ready = [];
2859
+ let moved = false;
2860
+ for (const [index, { unit, module, tag, decide, label }] of units.entries()) {
2861
+ const looked = firstLook[index];
2862
+ if (!looked) continue;
2863
+ let { input, decision } = moved ? await context.progress.during(label, "thinking", decide) : looked;
2814
2864
  while (decision.action === "pull-request") {
2815
2865
  const merged = await pullRequestFirst(context, decision);
2816
2866
  if (merged === "failed") return null;
@@ -2821,6 +2871,7 @@ const decideAll = async (context, environment, scope) => {
2821
2871
  };
2822
2872
  break;
2823
2873
  }
2874
+ moved = true;
2824
2875
  ({input, decision} = await decide());
2825
2876
  }
2826
2877
  if (decision.action === "choose") decision = await chosen(context, decision);
@@ -2923,6 +2974,8 @@ const shipRuns = async ({ services }, entries) => {
2923
2974
  units
2924
2975
  }));
2925
2976
  };
2977
+ /** A failed ship left its tag unshipped: the next run's first question offers it again. */
2978
+ const offerAgain = ({ output }, tags) => output.line(` ${paint("dim", `Run shiplane again: it offers ${listed(tags)} again`)}`);
2926
2979
  /** `Ship a through GitHub Actions`, or each tag with its way when they differ. */
2927
2980
  const shipQuestion = (going, paths, environment, context) => {
2928
2981
  const label = environmentLabel(context, going.map(({ unit }) => unit.name), environment);
@@ -3017,6 +3070,7 @@ const shipTo = async (context, environment, { scope, via, envChecked = /* @__PUR
3017
3070
  } catch (error) {
3018
3071
  const reason = error instanceof Error ? error.message : String(error);
3019
3072
  fail(context, `${job.label} failed`, `${reason}, nothing after it ran.`);
3073
+ offerAgain(context, [entry.input.tag]);
3020
3074
  return false;
3021
3075
  }
3022
3076
  const workflow = services.ciPipeline.shipWorkflow;
@@ -3030,6 +3084,7 @@ const shipTo = async (context, environment, { scope, via, envChecked = /* @__PUR
3030
3084
  } catch (error) {
3031
3085
  const reason = error instanceof Error ? error.message : String(error);
3032
3086
  fail(context, `${label} failed`, `${reason}, nothing after it ran.`);
3087
+ offerAgain(context, going.filter(({ unit }) => run.units.includes(unit.name)).map(({ input }) => input.tag));
3033
3088
  return false;
3034
3089
  }
3035
3090
  }
@@ -4179,4 +4234,4 @@ const readStatus = async (context, environment) => {
4179
4234
  //#endregion
4180
4235
  export { refreshEditorSchema as C, keysAt as D, ENVIRONMENTS as E, nodeFiles as O, CONFIG_FILE as S, optionsFor as T, loadRelease as _, releaseToPreview as a, initRelease as b, promote as c, pickScope as d, openReleasePr as f, findConfig as g, docsFor as h, setup as i, shipTo as l, newAdapter as m, systemShell as n, missingTags as o, prepareRelease as p, liveLine as r, tagRelease as s, readStatus as t, planShips as u, addUnit as v, environmentLabel as w, doctor as x, removeUnit as y };
4181
4236
 
4182
- //# sourceMappingURL=readStatus-QU-K9Czb.js.map
4237
+ //# sourceMappingURL=readStatus-DypM0faL.js.map