fetchReleases
Fetch the releases this codebase lacks, with their history.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { differ, fetchHistory, releaseKey } from "#codebase/tcmts/cli/sync"; import type { Remote } from "#codebase/tcmts/cli/sync"; export async function fetchReleases(cb: Codebase, remote: Remote): Promise<string[]> { const got: string[] = []; for (const r of (await remote.releases()).reverse()) { const mine = cb.store.release(r.package, r.version); if (mine && (mine.causal !== r.causal || mine.notes !== r.notes)) throw differ(remote, r, mine); if (mine) continue; await fetchHistory(cb, remote, r.causal); cb.store.putRelease(r); got.push(releaseKey(r)); } return got; }
uses
- tcmts.cli.codebase.Codebase
- tcmts.cli.sync.Remote
- tcmts.cli.sync.differ
- tcmts.cli.sync.fetchHistory
- tcmts.cli.sync.releaseKey