Skip to content

Commit 8113c0d

Browse files
committed
web: cells name the newest supported version when the newest one is not usable
1 parent cb97159 commit 8113c0d

3 files changed

Lines changed: 42 additions & 0 deletions

File tree

‎shared/compute.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ export interface CellSummary {
291291
latest?: { version: string; cell: Cell };
292292
/** A prerelease toolchain newer than `latest`, when one is known. */
293293
prerelease?: { version: string; cell: Cell };
294+
/** When `latest` is not usable: the newest stable version that is verified or declared. */
295+
latestSupported?: { version: string; cell: Cell };
294296
}
295297

296298
/**
@@ -322,6 +324,11 @@ export function summarizeCell(
322324
const prerelease = breakdown.find(
323325
(item) => item.prerelease && (!latest || breakdown.indexOf(item) < breakdown.indexOf(latest)),
324326
);
327+
const usable = (state: CellState) => state === "verified" || state === "declared";
328+
const latestSupported =
329+
latest && !usable(latest.cell.state)
330+
? breakdown.find((item) => !item.prerelease && item !== latest && usable(item.cell.state))
331+
: undefined;
325332

326333
return {
327334
state: verified.length ? "verified" : rawRange ? "declared" : "unverified",
@@ -333,6 +340,7 @@ export function summarizeCell(
333340
breakdown,
334341
...(latest ? { latest: { version: latest.version, cell: latest.cell } } : {}),
335342
...(prerelease ? { prerelease: { version: prerelease.version, cell: prerelease.cell } } : {}),
343+
...(latestSupported ? { latestSupported: { version: latestSupported.version, cell: latestSupported.cell } } : {}),
336344
};
337345
}
338346

‎test/compute.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,28 @@ describe("failed builds", () => {
195195
expect(doc().packages["@nativescript/android"].versions["9.1.1"].suspect).toEqual({ jdk: ["21", "17"] });
196196
});
197197
});
198+
199+
describe("latest supported", () => {
200+
it("names the newest usable version when the newest stable one is not", () => {
201+
const doc = buildDocument({
202+
generatedAt: "2026-09-09T00:00:00.000Z",
203+
toolchains: { xcode: [], cocoapods: [], compileSdk: [], buildTools: [], jdk: [{ version: "26", prerelease: true }, { version: "25" }, { version: "21" }, { version: "17" }], node: [] },
204+
packages: [
205+
{
206+
spec: { name: "@nativescript/android", toolchains: ["jdk"], keep: 5 },
207+
document: { distTags: {}, manifests: [{ version: "9.1.1", requirements: { jdk: ">=17" } }] },
208+
},
209+
],
210+
overrides: { requirements: [], advisories: [] },
211+
verified: [
212+
{ package: "@nativescript/android", version: "9.1.1", toolchains: { jdk: "25" }, with: { nativescript: "9.1.1", node: "24" }, outcome: "failure", attempts: 2, recordedAt: "2026-09-09T00:00:00Z" },
213+
{ package: "@nativescript/android", version: "9.1.1", toolchains: { jdk: "21" }, with: { nativescript: "9.1.1", node: "24" }, recordedAt: "2026-09-09T00:00:00Z" },
214+
],
215+
});
216+
const cell = summarizeCell(doc, "@nativescript/android", "9.1.1", "jdk");
217+
expect(cell.latest).toMatchObject({ version: "25", cell: { state: "unsupported" } });
218+
expect(cell.latestSupported).toMatchObject({ version: "21", cell: { state: "verified" } });
219+
expect(cell.prerelease).toMatchObject({ version: "26" });
220+
expect(summarizeCell(doc, "@nativescript/android", "9.1.1", "jdk").latestSupported?.version).not.toBe("17");
221+
});
222+
});

‎web/src/components/CompatCell.vue‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ const background = computed(() => {
4747
>
4848
<StateIcon :state="state" :size="22" class="mx-auto" />
4949
<span class="mt-1 block tabular-nums" :class="TEXT[state]">{{ summary.latest?.version ?? "No data" }}</span>
50+
<span
51+
v-if="summary.latestSupported"
52+
class="mt-0.5 flex items-center justify-center gap-1 text-[11px] tabular-nums"
53+
:title="`${summary.latestSupported.version}: ${summary.latestSupported.cell.reason}`"
54+
>
55+
<StateIcon :state="summary.latestSupported.cell.state" :size="12" />
56+
<span class="font-medium text-ok">{{ summary.latestSupported.version }}</span>
57+
<span class="text-neutral-500 dark:text-neutral-400">supported</span>
58+
</span>
5059
<span
5160
v-if="summary.prerelease"
5261
class="mt-0.5 flex items-center justify-center gap-1 text-[11px] tabular-nums text-neutral-500 dark:text-neutral-400"

0 commit comments

Comments
 (0)