releaseList
A package's releases, newest first: cheap (no checks), for listing.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { MARKER, writtenPart } from "#codebase/tcmts/cli/releases"; import { shortHash } from "#codebase/tcmts/core/hash"; export function releaseList(cb: Codebase, name: string) { return cb.store.releases(name).map((r) => ({ version: r.version, ts: r.ts, author: r.author, causal: shortHash(r.causal), summary: writtenPart(r.notes).split("\n").find((l) => l.trim() && !l.startsWith("<!--")) ?? "", notes: r.notes.replace(`${MARKER}\n\n`, "").trimEnd(), /** the notes without their heading (the page shows the version and date its own way) */ body: r.notes.replace(`${MARKER}\n\n`, "").replace(/^## .*\n+/, "").trimEnd(), })); }
uses
- tcmts.cli.codebase.Codebase
- tcmts.cli.releases.MARKER
- tcmts.cli.releases.writtenPart
- tcmts.core.hash.shortHash