turborepo
59a5e9c6 - chore: suggest ways to break cyclic dependencies (#9799)

Commit
340 days ago
chore: suggest ways to break cyclic dependencies (#9799) ### Description Closes #9270 by providing a suggestion on how to break a cycle found in the package graph. This implementation will only show the smallest cuts that could be made to break a cycle. So if the cycle can be broken by cutting only 2 dependencies than no cuts requiring 3 dependencies will be displayed. This also removes an error stutter we had when hitting cycles. Previously we would display two copies of the underlying error. Before: ``` [1 olszewski@chriss-mbp] /tmp/cycle $ turbo build turbo 2.3.5-canary.0 × Invalid package dependency graph: Cyclic dependency detected: │ @repo/ui, web, @repo/eslint-config ╰─▶ Cyclic dependency detected: @repo/ui, web, @repo/eslint-config ``` After: ``` [1 olszewski@chriss-mbp] /tmp/cycle $ turbo_dev --skip-infer build turbo 2.3.4-canary.9 × Invalid package dependency graph: ╰─▶ Cyclic dependency detected: @repo/eslint-config, @repo/ui, web The cycle can be broken by removing any of these sets of dependencies: {@repo/eslint-config -> web} ``` ### Testing Instructions Unit tests for the cut sets as well as a snapshot test that displays the additional suggestion now on the error message.
Parents
Loading