Skip to content

Commit d542048

Browse files
committed
add the actual cycle to the build output
1 parent db799c2 commit d542048

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • src/default-rules/circular-dependencies

src/default-rules/circular-dependencies/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,14 @@ export const validateRegistries = (maybeRegistries: string | string[] | undefine
4848
export const createNodeName = (node: string, commonPrefix: string): string =>
4949
node.substring(commonPrefix.length, node.length) || commonPrefix;
5050

51-
const createUserOutput = (commonPrefix: string, cycleGraph: graphlib.Graph): string =>
52-
`cyclic root folder: ${commonPrefix}${EOL}${dot.write(cycleGraph)}`;
51+
const createUserOutput = (
52+
commonPrefix: string,
53+
cycleGraph: graphlib.Graph,
54+
cycle: string[],
55+
): string =>
56+
`cyclic root folder: ${commonPrefix}${EOL}${dot.write(cycleGraph)}${EOL}Cycle:${cycle.join(
57+
' -> ',
58+
)}`;
5359

5460
const createMappedCycleMessage = (cycle: string[], mapping: Mapping, graph: graphlib.Graph) => {
5561
const cycleGraph = new graphlib.Graph();
@@ -77,7 +83,7 @@ const createMappedCycleMessage = (cycle: string[], mapping: Mapping, graph: grap
7783
);
7884
});
7985

80-
return createUserOutput(commonPrefix, cycleGraph);
86+
return createUserOutput(commonPrefix, cycleGraph, cycle);
8187
};
8288

8389
const createCycleMessage = (cycle: string[], graph: graphlib.Graph) =>

0 commit comments

Comments
 (0)