releaseCheck

tcmts.cli.release_pages.releaseCheck · #2rb4xnfl · term · runs on the server

uses tcmts.cli.releases.planRelease, which uses tcmts.cli.manifests.packagesIn, which uses tcmts.cli.config.configValue, which uses node:path

A package's next release: what it would be, and why.

import type { Codebase } from "#codebase/tcmts/cli/codebase";
import { packagesIn } from "#codebase/tcmts/cli/manifests";
import { checks } from "#codebase/tcmts/cli/release_pages";
import type { CheckView } from "#codebase/tcmts/cli/release_pages";
import { blockers, generatedNotes, planRelease, reasonFor } from "#codebase/tcmts/cli/releases";
import { LINTS } from "#codebase/tcmts/cli/semver_checks";

export function releaseCheck(cb: Codebase, name: string): CheckView {
  const key = `${cb.store.head()} ${name} ${cb.store.releases(name)[0]?.version ?? ""} ${cb.store.todos().length} ${cb.store.contributions().length}`;
  const kept = checks.get(key);
  if (kept) return kept;
  const plan = planRelease(cb, name, undefined, true);
  const rows = cb.store.names();
  const hashOf = (p: string) => cb.store.hashesAt(p)[0];
  const view: CheckView = {
    name: plan.pkg.name,
    version: plan.computed,
    after: plan.prev?.version,
    reason: reasonFor(plan),
    level: plan.level,
    findings: (plan.report?.findings ?? []).map((f) => ({ lint: f.lint, level: LINTS[f.lint].level, path: f.path, summary: LINTS[f.lint].summary, why: LINTS[f.lint].why, detail: f.detail, hash: hashOf(f.path) })),
    following: plan.report?.following ?? [],
    notes: generatedNotes(cb, plan, cb.store.contributions()),
    blocked: blockers(cb, plan.pkg, packagesIn(cb, rows), rows),
    upToDate: !!plan.report && !plan.report.findings.length,
  };
  if (checks.size > 50) checks.clear();
  checks.set(key, view);
  return view;
}

uses

used by