Skip to content

Commit

Permalink
add the actual cycle to the build output
Browse files Browse the repository at this point in the history
  • Loading branch information
pravliv committed Mar 21, 2024
1 parent db799c2 commit 4583f62
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/default-rules/circular-dependencies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ export const validateRegistries = (maybeRegistries: string | string[] | undefine
export const createNodeName = (node: string, commonPrefix: string): string =>
node.substring(commonPrefix.length, node.length) || commonPrefix;

const createUserOutput = (commonPrefix: string, cycleGraph: graphlib.Graph): string =>
`cyclic root folder: ${commonPrefix}${EOL}${dot.write(cycleGraph)}`;
const createUserOutput = (
commonPrefix: string,
cycleGraph: graphlib.Graph,
cycle: string[],
): string =>
`cyclic root folder: ${commonPrefix}${EOL}${dot.write(cycleGraph)}${EOL}${cycle.join(' -> ')}`;

const createMappedCycleMessage = (cycle: string[], mapping: Mapping, graph: graphlib.Graph) => {
const cycleGraph = new graphlib.Graph();
Expand Down Expand Up @@ -77,7 +81,7 @@ const createMappedCycleMessage = (cycle: string[], mapping: Mapping, graph: grap
);
});

return createUserOutput(commonPrefix, cycleGraph);
return createUserOutput(commonPrefix, cycleGraph, cycle);
};

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

0 comments on commit 4583f62

Please sign in to comment.