releasePage

tcmts.cli.release_pages.releasePage · #rsfqefe5 · term · runs on the server

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

A package's page: its manifest, its next release, and its releases (the changelog), newest first.

import type { Codebase } from "#codebase/tcmts/cli/codebase";
import { exportsOf, packagesIn } from "#codebase/tcmts/cli/manifests";
import { releaseCheck, releaseList } from "#codebase/tcmts/cli/release_pages";
import { changelog } from "#codebase/tcmts/cli/releases";

export function releasePage(cb: Codebase, name: string) {
  const rows = cb.store.names();
  const all = packagesIn(cb, rows);
  const pkg = all.find((p) => p.name === name);
  if (!pkg) throw new Error(`no package ${name} on this branch`);
  const subpaths = new Map<string, number>();
  for (const sub of exportsOf(pkg, all, rows).values()) subpaths.set(sub, (subpaths.get(sub) ?? 0) + 1);
  return {
    name: pkg.name,
    namespace: pkg.namespace,
    manifestHash: pkg.manifestHash,
    description: pkg.manifest.description,
    exports: [...subpaths].map(([subpath, count]) => ({ subpath, count })),
    bin: Object.entries(pkg.manifest.bin).map(([command, target]) => ({ command, target })),
    with: pkg.manifest.with,
    next: releaseCheck(cb, name),
    releases: releaseList(cb, name),
    changelog: changelog(cb, name),
  };
}

uses

used by