tcmts.cli.builds

test/
3 definitions

Types

TcmBuild type
A tcm kept to run again: the known-good one, the one it replaced, or an older one.

Server

buildBin (dir: string) => string | undefined
A build's tcm.js: its tcm-ts install's, or another package's there with a `tcm` command (what `tcm builds make` installs from a codebase whose package of that command has another name).
buildRecord (dir: string) => Pick<TcmBuild, "at" | "head" | "how" | "when"> | undefined
What a build's directory says it was made from: `build.json` (what `tcm builds make` writes: head, when), or what `pnpm verify` leaves (`verified.json`'s head; `VERIFIED`, "#<head>, verified <when>"). Undefined for a directory that says neither.
buildsDir (env?: ProcessEnv, running?: string | undefined) => string | undefined
The directory tcm builds are kept in: the one TCM_BUILDS names (tcm's repository's `dist/`: `pnpm tcm` sets it), or, when the tcm running is a kept build itself (one saying what it was made from, as `dist/known-good` does), the directory holding it. Undefined otherwise: a tcm installed from npm keeps no builds.
keptBuilds (root: string) => TcmBuild[]
The builds kept in `root`: the known-good one (`known-good`), the one it replaced (`previous`, in `known-good-previous`), then older ones (`builds/<id>`), newest first.
makeBuild (cb: Codebase, root: string, entry: string) => { build: TcmBuild; made: boolean; }
`tcm builds make <entry>`: a build of the codebase's tcm (its package whose command is `tcm`) as it was at a history entry, kept with the others in `root` (`builds/<id>`) to run as they are. It's packed from the codebase as it was then, by this tcm, and installed beside a clone of the known-good install's dependencies when they're the same (seconds), or by npm. One kept already is that one.
printBuilds (root: string | undefined, cb: Codebase | undefined) => void
`tcm builds`: the builds kept in `root`, newest first, each with its name (what `--build` takes), the history entry it was made from (with `cb`, the codebase's: how far back on this branch, and its command), when, what changed in it (the entries since the build before it in history), and its tcm.js.
pruneKeptBuilds (root: string, keep?: number) => string[]
The older builds (`builds/`) but the newest `keep`, removed: their names.
resolveBuild (spec: string, root: string | undefined, cwd?: string) => string
The tcm.js a build's name means: `known-good`, `previous`, a kept build's id (the history entry it was made from: a prefix will do, `#` or not), or a path (a tcm.js, or a build's directory).
retireBuild (root: string, dir: string, keep?: number) => string | undefined
A build that's being replaced (the one before the known-good, when `pnpm verify` makes a new one), kept among the older ones as `builds/<id>`, named by the history entry it was made from, the oldest beyond `keep` going. One that doesn't say what it was made from, or one kept already, goes. Where it's kept.
runOnBuild (spec: string, argv: string[], cwd?: string) => number
`tcm --build <build> <command…>`: the command run by a kept build (`resolveBuild`: known-good, previous, an id, a path) rather than this tcm, as that build runs it: here, on the codebase (and branch) TCM_CODEBASE and TCM_BRANCH name. `-C <dir>` after it runs it in that directory, on the codebase there and its own branch, as `tcm -C` does, whether that build knows `-C` or not. Its exit status.

Shared

KEEP_BUILDS 4
How many older builds `builds/` keeps, beside the known-good one and the one before it: when another is kept, the oldest beyond these go. Each is a tcm install, about 80 MB, most of it shared with the next where the filesystem clones files (APFS: `pnpm verify` makes each from a clone of the last).