Add cyclic dependencies check

Add new check based on tool "madge" to prevent cyclic dependencies regressions.
Madge currently reports 10 cycles. The new check makes sure we don't introduce new ones.

Bug: b/261552483
Test: npm run deps_graph:check_cycles
Change-Id: I2630ddcb94101be9b288ce0708fca3231962f406
This commit is contained in:
Kean Mariotti
2022-12-30 14:34:33 +00:00
parent 73be9787b6
commit 547e0f5f4b
2 changed files with 1836 additions and 11 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@
"format:fix": "(ls *.js .*.js && find src/ -regextype egrep -regex '^.*(\\.ts|\\.js)$') |xargs npx prettier --write",
"lint:check": "(ls *.js .*.js && find src/ -regextype egrep -regex '^.*(\\.ts|\\.js)$') |xargs npx eslint --format=unix",
"lint:fix": "(ls *.js .*.js && find src/ -regextype egrep -regex '^.*(\\.ts|\\.js)$') |xargs npx eslint --format=unix --fix",
"deps_graph:check_cycles": "count=$(npx madge --extensions ts,js src/ --circular 2>&1 | awk '/Found.*circular dependencies/ {print $3}'); test ${count:-0} -le 10",
"start": "webpack serve --config webpack.config.dev.js --open --hot --port 8080",
"start:remote_tool_mock": "webpack serve --config src/test/remote_tool_mock/webpack.config.js --open --hot --port 8081",
"build:kotlin": "rm -rf kotlin_build && npx kotlinc-js -source-map -source-map-embed-sources always -module-kind commonjs -output kotlin_build/flicker.js ../../../platform_testing/libraries/flicker/src/com/android/server/wm/traces/common",
@@ -17,7 +18,7 @@
"test:unit": "jasmine dist/unit.spec/bundle.js",
"test:component": "npx karma start",
"test:e2e": "npx protractor protractor.config.js",
"test:all": "npm run test:unit && npm run test:component && npm run test:e2e && npm run format:check && npm run lint:check"
"test:all": "npm run test:unit && npm run test:component && npm run test:e2e && npm run format:check && npm run lint:check && npm run deps_graph:check_cycles"
},
"private": true,
"dependencies": {
@@ -36,9 +37,6 @@
"@ngrx/effects": "^14.0.2",
"@ngrx/store": "^14.0.2",
"@ngxs/store": "^3.7.4",
"@types/jsbn": "^1.2.30",
"@types/three": "^0.143.0",
"angular2-template-loader": "^0.6.2",
"auth0": "^3.0.1",
"dateformat": "^5.0.3",
"gl-matrix": "^3.4.3",
@@ -50,7 +48,6 @@
"jsbn-rsa": "^1.0.4",
"kotlin": "^1.7.0",
"kotlin-compiler": "^1.7.0",
"loader-utils": "^2.0.0",
"protobufjs": "^6.11.3",
"rxjs": "~7.5.0",
"style-loader": "^3.3.1",
@@ -72,10 +69,13 @@
"@types/dateformat": "^5.0.0",
"@types/jasmine": "~4.3.1",
"@types/jquery": "^3.5.14",
"@types/jsbn": "^1.2.30",
"@types/node": "^18.0.4",
"@types/three": "^0.143.0",
"@types/w3c-web-usb": "^1.0.6",
"@typescript-eslint/eslint-plugin": "^5.30.6",
"@typescript-eslint/parser": "^5.30.6",
"angular2-template-loader": "^0.6.2",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
@@ -86,6 +86,8 @@
"karma-jasmine": "~5.0.0",
"karma-sourcemap-loader": "^0.3.8",
"karma-webpack": "^5.0.0",
"loader-utils": "^2.0.0",
"madge": "^5.0.1",
"prettier": "^2.8.1",
"prettier-plugin-organize-imports": "^3.2.1",
"protractor": "^7.0.0",