Plannedtypeno test imports ittype Planned = { readonly name: string; readonly folder: string; readonly verify: string };A library as the plan reads it.
The plan of CI (commons 0001-libraries FR-012): the libraries a push or a pull request affects, and for each the cells that the one workflow ci runs, so that a change proves what it touches and nothing else.
bun commons/libraries/src/plan.ts --base origin/main the plan for what changed since the merge base with origin/main, as JSON bun commons/libraries/src/plan.ts --all every library bun commons/libraries/src/plan.ts --files a.ts,b/c.ts the libraries these files affect bun commons/libraries/src/plan.ts --base REF --github-output "$GITHUB_OUTPUT" the same, written as the outputs of a step: has-linux, linux, has-systems, systems
The libraries are those of affected.ts (the same code the development loop and every check read), with the reach of verify: what a library's verify reads, and what depends on it. Each library has a cell on Linux; a library whose record of CI (LIBRARY_CI) names Windows or macOS has a cell on each of them too, because it has code of its own for them. A matrix with no cell is not written as a matrix (a workflow cannot run one): has-linux and has-systems say whether there is one.
import { planOf } from "./plan.ts";
planOf([{ name: "net", folder: "commons/net", verify: "bun run verify" }]).systems.include.map((c) => c.os); // ["windows-latest", "macos-latest"]Spec: 0001-libraries FR-012
Plannedtypeno test imports ittype Planned = { readonly name: string; readonly folder: string; readonly verify: string };A library as the plan reads it.
Includetypeno test imports ittype Include = { readonly include: readonly Cell[] };The cells of a job: what strategy.matrix reads as {"include": [...]}.
planOffunctionfunction planOf(libs: readonly Planned[], packs?: ReadonlySet<string>): PlanThe plan for these libraries: a cell on Linux for each, and one on each system its record names, in the order of the libraries; the packing is checked in the cells of the libraries named in packs.
exportsLinefunctionfunction exportsLine(packageJson: string): stringThe exports of a package.json as one line, the keys in order, so that two of them are the same where the entries are.
packsForfunctionfunction packsFor(repo: string, base: string, libs: readonly Planned[], single?: boolean): Promise<ReadonlySet<string>>The libraries whose packing a push checks (FR-013): those that changed their exports since the base (a new library included), and every library where the packer itself changed. Git that cannot say gives every library.
outputsOffunctionfunction outputsOf(p: Plan): stringThe outputs of a step that a workflow reads: the matrices as one line of JSON each and whether each has a cell.