IF Commons GitHub

metapackages

The metapackages of commons (commons 0036-distribution FR-005 to FR-008): five packages with no code of their own, each a set of libraries at the exact versions of one release. @intellectual-frontiers/commons is every consumer-facing library; foundation, patterns, programs and standards are the four roles of the libraries. A repository other than .github installs commons by installing one of them, or a library, from a registry.

Pure: the libraries as data give the members of a set, the exact dependencies of its package, the file that records them, the package.json and the README that are published. The role of a library is read from ROLE_OF of readme.ts, the one place that says it, and the set of a role is the role's: foundation, pattern (patterns), program (programs) and standard (standards). A library is consumer-facing where its distribution names npm and it is not a metapackage and not held back (HELD_BACK); the package of a member is the package it publishes (publishedPackage). A member whose role is not known is a problem and never a member of no set. The effects (writing the files, packing) are pack-metapackage.ts.

import { dependenciesOf } from "./metapackages.ts";
dependenciesOf([{ library: "core", package: "@intellectual-frontiers/core", version: "0.1.5" }]); // { "@intellectual-frontiers/core": "0.1.5" }

Spec: 0001-libraries FR-023

Source: commons/libraries/src/metapackages.ts

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

HELD_BACKconst
const HELD_BACK: ReadonlyMap<string, string>

The libraries that are not in any set yet, each with why: they declare npm and are not ready to be installed (commons 0036-distribution FR-006). A library leaves this list when its owner releases it.

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

BUNDLE_OF_ROLEconst
const BUNDLE_OF_ROLE: Readonly<Record<"foundation" | "pattern" | "program" | "standard", "foundation" | "patterns" | "programs" | "standards">>

The roles' sets: a role is in exactly one.

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

Membertypeno test imports it
type Member = { readonly library: string; readonly package: string; readonly version: string };

A member of a set: the library, the package it publishes and the version of this release.

Dependenciestypeno test imports it
type Dependencies = Readonly<Record<string, string>>;

The exact dependencies of a package: the name of each member and its version, nothing else.

isConsumerFacingfunction
function isConsumerFacing(l: Pick<Library, "bundle" | "distribution" | "held" | "name">): boolean

Whether a library is installed by a set: it names npm, it is no metapackage and it is not held back.

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

membersOffunction
function membersOf(bundle: "commons" | "foundation" | "patterns" | "programs" | "standards", libraries: readonly Library[]): Result<readonly Member[], string>

The members of a set, in the order of their packages' names; the problem where a consumer-facing library has no role in ROLE_OF.

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

dependenciesOffunction
function dependenciesOf(members: readonly Member[]): Readonly<Record<string, string>>

The exact dependencies of the package of a set: each member's package at its version, no range.

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

setFileTextfunction
function setFileText(bundle: "commons" | "foundation" | "patterns" | "programs" | "standards", members: readonly Member[]): string

What the generated file of a set holds: the set and its exact dependencies.

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

SET_FILEconst
const SET_FILE: "dependencies.auto.json"

The generated file of a set, from its folder.

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

readSetFilefunction
function readSetFile(text: string): Result<Readonly<Record<string, string>>, string>

The dependencies a generated file holds, or why its text is not one.

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

descriptionOffunctionno test imports it
function descriptionOf(bundle: "commons" | "foundation" | "patterns" | "programs" | "standards"): string

The text of a set's own description, which the package carries.

readmeOffunction
function readmeOf(bundle: "commons" | "foundation" | "patterns" | "programs" | "standards", members: readonly Member[]): string

The README of a set's package: what it holds, how to install it from npm and from the GitHub package registry, and how to keep one copy of each library.

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

publishedManifestfunctionno test imports it
function publishedManifest(bundle: "commons" | "foundation" | "patterns" | "programs" | "standards", version: string, dependencies: Readonly<Record<string, string>>, license: string): Readonly<Record<string, unknown>>

The package.json that is published for a set: no code, one empty entry, the exact dependencies.

ENTRY_JSconstno test imports it
const ENTRY_JS: "export {};\n"

The one file of code of a set's package, and its declaration: an empty module, so that the entry imports.

ENTRY_DTSconstno test imports it
const ENTRY_DTS: "export {};\n"

The declaration of ENTRY_JS.

ALL_BUNDLESconstno test imports it
const ALL_BUNDLES: readonly ("commons" | "foundation" | "patterns" | "programs" | "standards")[]

Every set, in the order the README lists them.

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