What a change affects (commons 0027-commons-librariesFR-019 to FR-022): the files a library's checks read, taken from its package and its sources, and the libraries that a list of changed files affects, so that CI runs what changed and nothing else.
bun commons/libraries/src/affected.ts --base origin/main the libraries a change since the merge base with origin/main affects, as {"include":[{"name","folder","verify"}]} bun commons/libraries/src/affected.ts --files a.ts,b/c.ts the same for a list of files (paths from the repository's root) bun commons/libraries/src/affected.ts --all every library bun commons/libraries/src/affected.ts --inputs data the folders and files the library data reads, one a line other flags: --repo DIR (the repository, the working folder by default)
A library depends on another folder of commons where its package.json names it by path (link:, file: or workspace:), and what it reads of it is what its sources import from the package (the exports of the dependency say which file each import is), what its scripts run by a path to another folder (bun ../libraries/src/check.ts), and everything those files import by a relative path, followed file by file. An import that no entry of exports names takes the whole dependency. The library's inputs are also commons/tools/**, .github/actions/**, its own workflow and its own folder. A library is affected where a changed file is among its inputs, or where a library it depends on is affected. Nothing is run and nothing is written; the result is the same for the same files.
type Inputs = {
/** The paths of the library's inputs: `commons/<name>/` and each folder (`commons/core/src/**`) or fi…(784 characters)
typeInputs= {
/** The paths of the library's inputs: `commons/<name>/` and each folder (`commons/core/src/**`) or file the library takes from another. */readonlypaths:readonlystring[];
/** The folders of commons that the library depends on through its package. */readonlydependsOn:readonlystring[];
/** Every file of another folder that it reads, from the repository's root, in order. */readonlyfiles:readonlystring[];
/** The libraries whose package its sources import by name: what its types and its tests read, which its scripts do not add. */readonlyimports:readonlystring[];
/** The paths its types and its tests read: its folder and what its imports reach (no tool its scripts run, no workflow). */readonlycodePaths:readonlystring[];
};
What a library reads: its folder, the folders and files it takes from others, what it depends on, and the files it imports one by one.
What a change reaches: verify, everything the library's verify reads (its scripts' tools, the shared tools, its workflow: what CI runs), or code, what its types and its tests read (its folder and the packages its sources import, which is what the development loop runs).
The libraries that a list of changed files affects (FR-021): those with a changed file among their inputs, and those that depend on one of these, in order of their names.