mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 11:13:21 +00:00
test(architecture): ratchet top-level layer direction and mutual imports (#10584)
* test(architecture): ratchet top-level layer direction and mutual imports Declare a layer for every top-level src/ directory and root source file (domain, contracts, foundation, providers, application, composition, adapters) in scripts/lib/module-layers.mjs. verify:module-boundaries now also builds the production import graph between those units and compares it with a counted baseline: 45 unit pairs import a higher layer (248 imports) and 23 unit pairs import each other. A new upward pair, more imports on a recorded pair, a new mutual import, or an undeclared unit fails; shrinkage is reported so the baseline can be lowered. * fix(architecture): enforce layers for isolated units
This commit is contained in:
1 parent
351c2f4a03
commit
8c052bdec5
8 files changed
+472
-9
No files matched your search
@@ -0,0 +1,21 @@
|
||||
export declare const LAYER_ORDER: readonly string[];
|
||||
export declare const UNIT_LAYERS: Readonly<Record<string, string>>;
|
||||
|
||||
/** The top-level unit of a production `src/` file, or undefined. */
|
||||
export function sourceUnit(path: string): string | undefined;
|
||||
|
||||
export interface LayerGraphFacts {
|
||||
readonly undeclared: readonly string[];
|
||||
readonly upward: Readonly<Record<string, number>>;
|
||||
readonly cycles: readonly string[];
|
||||
}
|
||||
|
||||
export function layerGraphFacts(
|
||||
imports: readonly { readonly file: string; readonly target: string }[],
|
||||
files?: readonly string[],
|
||||
): LayerGraphFacts;
|
||||
|
||||
export function compareLayerBaseline(
|
||||
facts: LayerGraphFacts,
|
||||
baseline: Pick<LayerGraphFacts, "upward" | "cycles">,
|
||||
): { readonly failures: string[]; readonly lowerable: string[] };
|
||||
Reference in new issue
Block a user