IF Commons GitHub

logical/status

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-repoctl-status-release FR-001

repoctl status (commons repoctl 0004-repoctl-status-release FR-001 to FR-003): for each library of the repository, its version in the repository, the version npm shows and the version of its greatest tag, as rows (a table for a person, JSON for a program). What npm shows is reported as it shows it: a version that was published a short while ago may not be listed yet, and nothing here guesses that it is on its way. --offline asks no network: npm is not asked and the tags are those of the local clone.

import { tagsOf } from "./status.ts";
tagsOf("abc\trefs/tags/core-v0.1.0\nabc\trefs/tags/core-v0.1.0^{}\n").get("core"); // ["0.1.0"]

Source: commons/repoctl/src/logical/status.ts

5 of 20 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

logical.NpmCelltypeno test imports it
type NpmCell =
  | { readonly kind: "skipped" }
  | { readonly kind: "not-published" }
  | { readonly kind: "absent" }
  | { readonly kind: "unreachable"; readonly why: string }
  | { readonly kind: "found"; readonly latest: string | undefined; readonly hasRepoVersion: boolean };

What npm shows of a library's package.

logical.TagCelltypeno test imports it
type TagCell =
  | { readonly kind: "unreachable"; readonly why: string }
  | { readonly kind: "none"; readonly source: "remote" | "local" }
  | { readonly kind: "found"; readonly latest: string; readonly hasRepoVersion: boolean; readonly source: "remote" | "local" };

What the tags show of a library.

logical.Statetypeno test imports it
type State = "released" | "unpublished" | "untagged" | "unknown" | "held";

Where a library stands, from the three versions.

logical.Rowtypeno test imports it
type Row = { readonly library: string; readonly repo: string; readonly npm: NpmCell; readonly tag: TagCell; readonly state: State };

One row of the status.

logical.StatusReporttypeno test imports it
type StatusReport = { readonly offline: boolean; readonly rows: readonly Row[] };

The status: its rows, in the order of the libraries' names.

logical.tagsOffunctionno test imports it
function tagsOf(text: string): ReadonlyMap<string, readonly string[]>

The versions each library is tagged at, from the lines of git ls-remote --tags (a sha, a tab, the reference) or of git tag --list (the name alone).

logical.stateOffunctionno test imports it
function stateOf(lib: Pick<LibraryInfo, "held" | "npm">, npm: NpmCell, tag: TagCell): State

Where a library stands: it is released when npm holds its repository version (or it is not on npm) and its tag is made; what is not known is unknown.

logical.runStatusfunctionno test imports it
function runStatus(w: World, options: { readonly offline: boolean; }): Promise<Result<StatusReport, string>>

Reads the status of every library. The error is why the libraries or the tags could not be read at all.

logical.findingsOfStatusfunctionno test imports it
function findingsOfStatus(r: StatusReport): readonly Finding[]

The findings of a status: a registry or a tag list that could not be read, as warnings.

logical.tableOffunctionno test imports it
function tableOf(r: StatusReport): string

The table of a status for a person: one line for each library, columns aligned.

NpmCelltypeno test imports it
type NpmCell =
  | { readonly kind: "skipped" }
  | { readonly kind: "not-published" }
  | { readonly kind: "absent" }
  | { readonly kind: "unreachable"; readonly why: string }
  | { readonly kind: "found"; readonly latest: string | undefined; readonly hasRepoVersion: boolean };

What npm shows of a library's package.

TagCelltypeno test imports it
type TagCell =
  | { readonly kind: "unreachable"; readonly why: string }
  | { readonly kind: "none"; readonly source: "remote" | "local" }
  | { readonly kind: "found"; readonly latest: string; readonly hasRepoVersion: boolean; readonly source: "remote" | "local" };

What the tags show of a library.

Statetypeno test imports it
type State = "released" | "unpublished" | "untagged" | "unknown" | "held";

Where a library stands, from the three versions.

Rowtypeno test imports it
type Row = { readonly library: string; readonly repo: string; readonly npm: NpmCell; readonly tag: TagCell; readonly state: State };

One row of the status.

StatusReporttypeno test imports it
type StatusReport = { readonly offline: boolean; readonly rows: readonly Row[] };

The status: its rows, in the order of the libraries' names.

tagsOffunction
function tagsOf(text: string): ReadonlyMap<string, readonly string[]>

The versions each library is tagged at, from the lines of git ls-remote --tags (a sha, a tab, the reference) or of git tag --list (the name alone).

Imported by 14 tests of the run (14 passed, 0 failed): the library's results

stateOffunction
function stateOf(lib: Pick<LibraryInfo, "held" | "npm">, npm: NpmCell, tag: TagCell): State

Where a library stands: it is released when npm holds its repository version (or it is not on npm) and its tag is made; what is not known is unknown.

Imported by 14 tests of the run (14 passed, 0 failed): the library's results

runStatusfunction
function runStatus(w: World, options: { readonly offline: boolean; }): Promise<Result<StatusReport, string>>

Reads the status of every library. The error is why the libraries or the tags could not be read at all.

Imported by 21 tests of the run (21 passed, 0 failed): the library's results

findingsOfStatusfunction
function findingsOfStatus(r: StatusReport): readonly Finding[]

The findings of a status: a registry or a tag list that could not be read, as warnings.

Imported by 14 tests of the run (14 passed, 0 failed): the library's results

tableOffunction
function tableOf(r: StatusReport): string

The table of a status for a person: one line for each library, columns aligned.

Imported by 14 tests of the run (14 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.