I currently use the dpdm lib to check for circular dependencies on the react-native project.
Example:
npx dpdm ./src/* --circular --exit-code circular:1 --warning=false
With error:
✔ [718/718] Analyze done!
• Circular Dependencies
01) src/services/index.ts -> src/services/Rating/index.ts
No error:
✔ [719/719] Analyze done!
• Circular Dependencies
✅ Congratulations, no circular dependency were found in your project.
CircleCI script fails if any circular dependency is found:
check-circular-dependency:
executor:
name: react-native/linux_js
node_version: '14'
steps:
- checkout-and-attach-workspace
- run:
name: Check for Circular dependency
command: npx dpdm ./src/* --circular --exit-code circular:1 --warning=false --tree=false
npx dpdm ./src/* --circular --exit-code circular:1 --warning false
– Sporogony