IF Commons GitHub

versions/works

Which files are a work's (commons 0026-works-versioning FR-009): a work is a folder that holds a release.ts; its files are every file Git tracks under the folder except those of a work nested in it, its own release.ts and CITATION.cff, and the paths its record names in exclude, and, besides, every tracked file under the paths its record names in paths (folders or files outside its folder, from the root of the repository: FR-039). Every judgement of a version is scoped to those files and to no others (path-scoped).

Pure: it works on lists of paths (as git ls-files or git ls-tree gives them, with /), so the same code scopes a tree at the head and at the base. A path is a work's by its place alone, so a file that was deleted is still told as the work's it was. A work of a repository of one work keeps its record at the root, and its folder is "".

import { scopeOf, workFolders } from "./works.ts";
const folders = workFolders(["a/release.ts", "a/x.ts", "a/b/release.ts", "a/b/y.ts"]); // ["a", "a/b"]
scopeOf("a", folders, [])("a/b/y.ts"); // false: it is a nested work's

Source: commons/mizan/src/versions/works.ts

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

versions.filesOffunctionno test imports it
function filesOf(tracked: readonly string[], folder: string, folders: readonly string[], exclude: readonly string[], extra?: readonly string[]): readonly string[]

The paths of a work among tracked paths.

versions.folderOffunctionno test imports it
function folderOf(path: string): string

The folder a path is in: everything before its last /, "" for a file at the root.

versions.isUnderfunctionno test imports it
function isUnder(path: string, under: string): boolean

Whether path is under or inside it ("" holds everything).

versions.recordPathOffunctionno test imports it
function recordPathOf(folder: string): string

The path of the record of the work in a folder.

versions.scopeOffunctionno test imports it
function scopeOf(folder: string, folders: readonly string[], exclude: readonly string[], paths?: readonly string[]): (path: string) => boolean

Whether a path is a file of the work in folder (FR-009, FR-039): under the folder, not under another work's folder nested in it, not its release.ts or CITATION.cff, and not under a path of exclude (paths of the folder); or, whatever the folder, under one of paths (paths of the repository that the record adds to the work's files), its own two files apart.

versions.workFoldersfunctionno test imports it
function workFolders(paths: readonly string[]): readonly string[]

The folders that hold a release.ts among tracked paths, in order.

filesOffunction
function filesOf(tracked: readonly string[], folder: string, folders: readonly string[], exclude: readonly string[], extra?: readonly string[]): readonly string[]

The paths of a work among tracked paths.

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

folderOffunctionno test imports it
function folderOf(path: string): string

The folder a path is in: everything before its last /, "" for a file at the root.

isUnderfunctionno test imports it
function isUnder(path: string, under: string): boolean

Whether path is under or inside it ("" holds everything).

recordPathOffunctionno test imports it
function recordPathOf(folder: string): string

The path of the record of the work in a folder.

scopeOffunction
function scopeOf(folder: string, folders: readonly string[], exclude: readonly string[], paths?: readonly string[]): (path: string) => boolean

Whether a path is a file of the work in folder (FR-009, FR-039): under the folder, not under another work's folder nested in it, not its release.ts or CITATION.cff, and not under a path of exclude (paths of the folder); or, whatever the folder, under one of paths (paths of the repository that the record adds to the work's files), its own two files apart.

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

workFoldersfunction
function workFolders(paths: readonly string[]): readonly string[]

The folders that hold a release.ts among tracked paths, in order.

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

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