logical.VersionConstanttypeno test imports ittype VersionConstant = { readonly file: string; readonly name: string };A constant of a library's sources that holds its version: the file from the library's folder and the constant's name.
The constants of the sources that say a library's version (commons repoctl 0003-repoctl-sync FR-008): a constant named for its library (ERGONEX_VERSION of ergonex), or named by the manifest in versionConstants, must say the version of its package. A release that raised the manifest and the package and left such a constant behind broke a build at one release; this finds it before the push. Pure: it reads texts it is given.
import { constantFindings } from "./constants.ts";
const lib = { name: "ergonex", folder: "commons/ergonex", version: "0.4.7", level: "L1", specKit: undefined, npm: true, versionConstants: [] };
constantFindings([lib], [{ path: "commons/ergonex/src/state-record.ts", text: 'export const ERGONEX_VERSION = "0.4.6";' }]).length; // 1logical.VersionConstanttypeno test imports ittype VersionConstant = { readonly file: string; readonly name: string };A constant of a library's sources that holds its version: the file from the library's folder and the constant's name.
logical.Sourcetypeno test imports ittype Source = { readonly path: string; readonly text: string };A source file: its path from the repository's root and its text.
logical.Foundtypeno test imports ittype Found = { readonly path: string; readonly name: string; readonly value: string; readonly line: number };One NAME_VERSION = "text" found in a source, and the line it is on.
logical.constantsInfunctionno test imports itfunction constantsIn(source: Source): readonly Found[]Every constant of a source that ends in _VERSION and is a text.
logical.conventionNamefunctionno test imports itfunction conventionName(library: string): stringThe name a library's own version constant has by convention: its name in capitals, hyphens as underscores, and _VERSION.
logical.isReadfunctionno test imports itfunction isRead(library: LibraryInfo, path: string): booleanThe sources of a library that are read for constants: the TypeScript under its src/, and the files its manifest names.
logical.constantFindingsfunctionno test imports itfunction constantFindings(libraries: readonly LibraryInfo[], sources: readonly Source[]): readonly Finding[]What is wrong with the constants of the libraries' sources: one that disagrees with its library's version, one the manifest names that is not there, one that is not a version.
VersionConstanttypeno test imports ittype VersionConstant = { readonly file: string; readonly name: string };A constant of a library's sources that holds its version: the file from the library's folder and the constant's name.
Sourcetypeno test imports ittype Source = { readonly path: string; readonly text: string };A source file: its path from the repository's root and its text.
Foundtypeno test imports ittype Found = { readonly path: string; readonly name: string; readonly value: string; readonly line: number };One NAME_VERSION = "text" found in a source, and the line it is on.
constantsInfunctionfunction constantsIn(source: Source): readonly Found[]Every constant of a source that ends in _VERSION and is a text.
conventionNamefunctionfunction conventionName(library: string): stringThe name a library's own version constant has by convention: its name in capitals, hyphens as underscores, and _VERSION.
isReadfunctionno test imports itfunction isRead(library: LibraryInfo, path: string): booleanThe sources of a library that are read for constants: the TypeScript under its src/, and the files its manifest names.
constantFindingsfunctionfunction constantFindings(libraries: readonly LibraryInfo[], sources: readonly Source[]): readonly Finding[]What is wrong with the constants of the libraries' sources: one that disagrees with its library's version, one the manifest names that is not there, one that is not a version.