package file→ .shtukbase/packages/code-functional-core/checks/lib.ts
checks/lib.ts
12 lines, 873 B.
- // Shared part of the functional-core checks: which files are the core. The core is named in the package
- // settings, /norms/code/code-functional-core.md, field `core:` (globs or folders from the project root).
- // Nothing named — the checks have nothing to judge and say so once.
- import { matcher, type Settings, type Source } from '../../code-lib/checks/lib/scan.ts';
- export function coreOf(srcs: Source[], set: Settings): { core: Source[]; isCore: (rel: string) => boolean; named: boolean } {
- const globs = (Array.isArray(set.core) ? set.core : set.core ? [set.core] : []).map(String).filter(Boolean);
- const isCore = matcher(globs);
- return { core: srcs.filter((s) => isCore(s.rel)), isCore, named: globs.length > 0 };
- }
- export const NOT_NAMED = 'the core is not named: write the paths of the pure code in core: on the page /norms/code/code-functional-core.md';