@intellectual-frontiers/libraries 0.1.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/versions.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `versions`, how works are versioned (commons 0026-works-versioning): `check` finds a work whose files changed since the base and whose version did not grow by its scheme, `bump` writes the next
2
+ * `versions`, how works are versioned (commons 0026-works-versioning): `check` finds a record that is wrong, an identity that changed and a version that went back since the base (a version grows at the release, `release.ts`, and not at every push), `bump` writes the next
3
3
  * version into a work's record, `tag` creates the annotated (and, where Git is set to sign, signed) tag `<slug>-v<version>`, `notes` prints the release notes from the capabilities closed since the
4
4
  * last tag, `cite` writes `CITATION.cff` from the record, and `ledger` derives the ledger of releases from the tags.
5
5
  *
@@ -29,7 +29,7 @@ import { stdio } from "@intellectual-frontiers/system";
29
29
  import { dayOf, decodeHarnessRecord, formatRecordError } from "@intellectual-frontiers/mizan/changes/declaration";
30
30
  import { citationOf } from "@intellectual-frontiers/mizan/versions/cite";
31
31
  import { releaseGate } from "@intellectual-frontiers/mizan/versions/gate";
32
- import { commitsSince, commitSeconds, createTag, editionFacts, findBase, changedBetween, isAncestor, isDirty, isRepository, readTags, readTree, readWorkingTree, resolveCommit, signingConfigured, tagAncestry, tagsMerged, text as gitText, } from "@intellectual-frontiers/mizan/versions/git";
32
+ import { commitsSince, commitSeconds, createTag, editionFacts, findBase, isAncestor, isDirty, isRepository, readTags, readTree, readWorkingTree, resolveCommit, signingConfigured, tagAncestry, tagsMerged, text as gitText, } from "@intellectual-frontiers/mizan/versions/git";
33
33
  import { editionsNeeded, judgeWorks, recordFindings, versionProblems, } from "@intellectual-frontiers/mizan/versions/judge";
34
34
  import { lastRelease, ledgerJson, ledgerText, readEarlier, readLedger, tagNameOf, } from "@intellectual-frontiers/mizan/versions/ledger";
35
35
  import { impactOfCommits, notesOf } from "@intellectual-frontiers/mizan/versions/notes";
@@ -85,7 +85,7 @@ const LEDGER = {
85
85
  against: value({ help: "An earlier `ledger --json` output: a tag of it that moved or is gone is a finding.", valueName: "FILE" }),
86
86
  };
87
87
  const HELP_SUMMARY = {
88
- check: "Find a work whose files changed and whose version did not grow.",
88
+ check: "Find a record that is wrong, an identity that changed and a version that went back (versions grow at the release).",
89
89
  bump: "Write the next version into a work's record.",
90
90
  tag: "Create the annotated tag of a work's version.",
91
91
  notes: "Print the release notes from the capabilities closed since the last tag.",
@@ -157,15 +157,12 @@ export async function checkVersions(repo, rev = "origin/main") {
157
157
  const baseTree = base.value.kind === "commit" ? await readTree(repo, base.value.commit) : ok({ paths: [], records: new Map() });
158
158
  if (baseTree.kind === "err")
159
159
  return notRunBecause(formatGitError(baseTree.error));
160
- const changed = base.value.kind === "commit" ? await changedBetween(repo, base.value.commit, headCommit.value) : ok([]);
161
- if (changed.kind === "err")
162
- return notRunBecause(formatGitError(changed.error));
163
160
  const editions = await editionFacts(repo, editionsNeeded(head.value, baseTree.value), headCommit.value);
164
161
  if (editions.kind === "err")
165
162
  return notRunBecause(formatGitError(editions.error));
166
163
  return {
167
164
  kind: "judged",
168
- findings: sortFindings(judgeWorks({ head: head.value, base: baseTree.value, changed: changed.value, editions: editions.value })),
165
+ findings: sortFindings(judgeWorks({ head: head.value, base: baseTree.value, changed: [], editions: editions.value })),
169
166
  works: workFolders(head.value.paths).length,
170
167
  from: base.value.kind === "commit" ? `the base ${base.value.commit.slice(0, 12)}` : "no base (the first commit)",
171
168
  };
@@ -3,9 +3,8 @@
3
3
  * are written once, the workflow of each library of commons is made from its manifest, and the rest are written here as values. Nothing is read from a file but the manifests, and nothing is written.
4
4
  *
5
5
  * @remarks
6
- * `workflows(libraries)` gives every workflow, in the order of their files' names; the library workflows come from `libraryWorkflow`, which reads the folder, the name and the `verify` command of a manifest
7
- * (0027-commons-libraries FR-012) and what else the library's job needs from `LIBRARY_CI`, the facts of CI that a manifest does not hold (a library without a record has the job `verify` and nothing else).
8
- * The workflows run on the same triggers, with the same jobs and steps and the same names as the hand-written ones they replaced, so that the names of their checks do not change.
6
+ * `workflows()` gives every workflow, in the order of their files' names; the libraries are proved by one workflow, `ci`, whose plan reads which libraries a change affects and runs a matrix of those (the folder, the
7
+ * name and the `verify` command of a manifest, 0027-commons-libraries FR-012, and what else the library needs from `LIBRARY_CI`, the facts of CI that a manifest does not hold: a library without a record has `verify` on Linux and nothing else).
9
8
  *
10
9
  * @limits
11
10
  * It does not run a workflow or read one; a library that registers needs no entry of `LIBRARY_CI` unless its CI is more than `verify`.
@@ -14,7 +13,7 @@
14
13
  *
15
14
  * @module
16
15
  */
17
- import { type CompositeAction, type Step, type Workflow } from "./model.js";
16
+ import { type CompositeAction, type Workflow } from "./model.js";
18
17
  /** The versions the workflows pin (FR-005): each once. */
19
18
  export declare const PIN: {
20
19
  readonly checkout: "actions/checkout@v4";
@@ -30,36 +29,40 @@ export declare const PIN: {
30
29
  export declare const NODE_VERSION = "26.13.1";
31
30
  /** The canary of Bun that runs the linter until a release does (FR-028 of 0005-typescript-runtime). */
32
31
  export declare const BUN_LINT_VERSION = "1.4.4-canary.20261115.1";
33
- /** What a library's manifest gives its workflow (0027-commons-libraries FR-012): the folder's name, the command that proves it and the paths it reads. Another module's `Library` has more, and is accepted as it is. */
34
- export type LibraryFacts = {
35
- readonly name: string;
36
- readonly verify: string;
37
- /** The paths whose change affects it, which the library's workflow runs on (0027-commons-libraries FR-022). */
38
- readonly paths: readonly string[];
39
- /** Where it is published (0027-commons-libraries FR-015 to FR-017): the registries, `github` and, where a decision says so, `npm`. */
40
- readonly distribution: readonly string[];
41
- };
42
- /** What a library's CI needs that its manifest does not say. */
32
+ /** The systems other than Linux that a library's CI may ask for: only a library with code of its own for one of them (paths, processes, sockets, scheduled jobs) names it. */
33
+ export type OtherSystem = "windows-latest" | "macos-latest";
34
+ /** What a library's CI needs that its manifest does not say: Linux and `verify` are for every library, and these are the rest. */
43
35
  export type LibraryCi = {
44
- /** The paragraph written under the workflow's name. */
45
- readonly comment: string;
46
- /** The steps after `verify`, in the job `verify`. */
47
- readonly afterVerify?: readonly Step[];
48
- /** The command that runs the tests on Node 26, the backup runtime, in a job of its own. */
36
+ /** The command that runs the tests on Node 26, the backup runtime, in the same job as `verify`. */
49
37
  readonly nodeTests?: string;
50
- /** The systems the library's jobs run on, in order of their importance to it; the first only (Linux) where it names none. */
51
- readonly systems?: readonly ("windows-latest" | "macos-latest" | "ubuntu-latest")[];
38
+ /** A command that runs after `verify`, in the same job. */
39
+ readonly after?: string;
40
+ /** The systems besides Linux where `verify` and the tests on Node run too, because the library has code of its own for them. */
41
+ readonly systems?: readonly OtherSystem[];
52
42
  };
53
- /** The facts of CI of the libraries that have more than `verify`, by the library's name. */
43
+ /** The facts of CI of the libraries that have more than `verify` on Linux, by the library's name; a library with no record has `verify` on Linux only. */
54
44
  export declare const LIBRARY_CI: Readonly<Record<string, LibraryCi>>;
55
- /** The workflow of a library of commons, made from its manifest (FR-006): its `verify` on Bun when its folder or what it imports changes, and its tests on Node where its record says so. */
56
- export declare function libraryWorkflow(l: LibraryFacts): Workflow;
57
- /**
58
- * The workflow that publishes a library to the registries its manifest names (0030-generated-workflows FR-009): on a tag `<name>-v<version>` it checks the tag is the version, proves the library, packs it
59
- * with its `tools/pack.ts` and sends the tarball to npm, with provenance and no token (npm's trusted publishing), and to the GitHub package registry with the workflow's own token.
60
- */
61
- export declare function publishWorkflow(l: LibraryFacts): Workflow;
45
+ /** A cell of the matrix of a job of `ci`: a library, and where it runs where it is not on Linux. */
46
+ export type Cell = {
47
+ readonly name: string;
48
+ readonly folder: string;
49
+ readonly verify: string;
50
+ /** The command that runs the tests on Node 26, or the empty string. */
51
+ readonly node: string;
52
+ /** The command that runs after `verify`, or the empty string. */
53
+ readonly after: string;
54
+ /** Whether the packing is checked in this cell: the library changed its `exports` (or the packer changed), or the run is of everything. A push does not pack otherwise; the release does. */
55
+ readonly pack: boolean;
56
+ /** The runner, for a cell that is not on Linux. */
57
+ readonly os?: OtherSystem;
58
+ };
59
+ /** The cell of a library on a system (`ubuntu-latest`, where it names none), from its manifest and its record of CI; `pack` says whether the packing is checked in it. */
60
+ export declare function cellOf(l: {
61
+ readonly name: string;
62
+ readonly folder: string;
63
+ readonly verify: string;
64
+ }, os?: OtherSystem, pack?: boolean): Cell;
62
65
  /** Every workflow, the libraries'' made from their manifests, in the order of their files' names. */
63
- export declare function workflows(libraries: readonly LibraryFacts[]): readonly Workflow[];
66
+ export declare function workflows(): readonly Workflow[];
64
67
  /** The composite actions of `.github/actions/`: the pinned Bun, which every workflow uses. */
65
68
  export declare const ACTIONS: readonly CompositeAction[];