MOBILE-4616: Count circular dependencies in CI
parent
7f4189cead
commit
3594277050
|
@ -62,6 +62,14 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
npm run build:prod
|
npm run build:prod
|
||||||
npm run prod --prefix cordova-plugin-moodleapp
|
npm run prod --prefix cordova-plugin-moodleapp
|
||||||
|
env:
|
||||||
|
MOODLE_APP_CIRCULAR_DEPENDENCIES: true
|
||||||
|
- name: Circular dependencies
|
||||||
|
run: |
|
||||||
|
cat circular-dependencies
|
||||||
|
lines=$(cat circular-dependencies | wc -l)
|
||||||
|
echo "Total circular dependencies: $lines"
|
||||||
|
test $lines -eq 204
|
||||||
- name: JavaScript code compatibility
|
- name: JavaScript code compatibility
|
||||||
run: |
|
run: |
|
||||||
npx check-es-compat www/*.js --polyfills="\{Array,String,TypedArray\}.prototype.at,Array.prototype.flatMap,Array.prototype.flat,Array.prototype.includes,globalThis,Object.fromEntries,Object.hasOwn,Promise.prototype.finally,String.prototype.matchAll,String.prototype.trimRight" | grep "No issues found. Files are compatible with the target runtimes."
|
npx check-es-compat www/*.js --polyfills="\{Array,String,TypedArray\}.prototype.at,Array.prototype.flatMap,Array.prototype.flat,Array.prototype.includes,globalThis,Object.fromEntries,Object.hasOwn,Promise.prototype.finally,String.prototype.matchAll,String.prototype.trimRight" | grep "No issues found. Files are compatible with the target runtimes."
|
||||||
|
|
|
@ -62,6 +62,7 @@ yarn-error.log
|
||||||
/libpeerconnection.log
|
/libpeerconnection.log
|
||||||
testem.log
|
testem.log
|
||||||
/typings
|
/typings
|
||||||
|
circular-dependencies
|
||||||
|
|
||||||
# System files
|
# System files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
@ -118,6 +118,7 @@
|
||||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||||
"@typescript-eslint/parser": "^6.0.0",
|
"@typescript-eslint/parser": "^6.0.0",
|
||||||
"check-es-compat": "3.2.0",
|
"check-es-compat": "3.2.0",
|
||||||
|
"circular-dependency-plugin": "^5.2.2",
|
||||||
"concurrently": "^8.2.0",
|
"concurrently": "^8.2.0",
|
||||||
"cordova-plugin-moodleapp": "file:cordova-plugin-moodleapp",
|
"cordova-plugin-moodleapp": "file:cordova-plugin-moodleapp",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
|
@ -9929,6 +9930,18 @@
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/circular-dependency-plugin": {
|
||||||
|
"version": "5.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/circular-dependency-plugin/-/circular-dependency-plugin-5.2.2.tgz",
|
||||||
|
"integrity": "sha512-g38K9Cm5WRwlaH6g03B9OEz/0qRizI+2I7n+Gz+L5DxXJAPAiWQvwlYNm1V1jkdpUv95bOe/ASm2vfi/G560jQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"webpack": ">=4.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cjs-module-lexer": {
|
"node_modules/cjs-module-lexer": {
|
||||||
"version": "1.3.1",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz",
|
||||||
|
|
|
@ -152,6 +152,7 @@
|
||||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||||
"@typescript-eslint/parser": "^6.0.0",
|
"@typescript-eslint/parser": "^6.0.0",
|
||||||
"check-es-compat": "3.2.0",
|
"check-es-compat": "3.2.0",
|
||||||
|
"circular-dependency-plugin": "^5.2.2",
|
||||||
"concurrently": "^8.2.0",
|
"concurrently": "^8.2.0",
|
||||||
"cordova-plugin-moodleapp": "file:cordova-plugin-moodleapp",
|
"cordova-plugin-moodleapp": "file:cordova-plugin-moodleapp",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
|
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
||||||
|
const { appendFileSync } = require('fs');
|
||||||
|
|
||||||
module.exports = config => {
|
module.exports = config => {
|
||||||
config.optimization.minimizer.push(
|
config.optimization.minimizer.push(
|
||||||
|
@ -46,5 +48,20 @@ module.exports = config => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.env.MOODLE_APP_CIRCULAR_DEPENDENCIES) {
|
||||||
|
config.plugins.push(
|
||||||
|
new CircularDependencyPlugin({
|
||||||
|
exclude: /node_modules/,
|
||||||
|
cwd: process.cwd(),
|
||||||
|
onDetected({ paths }) {
|
||||||
|
appendFileSync(
|
||||||
|
`${process.cwd()}/circular-dependencies`,
|
||||||
|
paths.join(' -> ') + '\n',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue