MOBILE-4616: Count circular dependencies in CI
parent
7f4189cead
commit
3594277050
|
@ -62,6 +62,14 @@ jobs:
|
|||
run: |
|
||||
npm run build:prod
|
||||
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
|
||||
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."
|
||||
|
|
|
@ -62,6 +62,7 @@ yarn-error.log
|
|||
/libpeerconnection.log
|
||||
testem.log
|
||||
/typings
|
||||
circular-dependencies
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -152,6 +152,7 @@
|
|||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"check-es-compat": "3.2.0",
|
||||
"circular-dependency-plugin": "^5.2.2",
|
||||
"concurrently": "^8.2.0",
|
||||
"cordova-plugin-moodleapp": "file:cordova-plugin-moodleapp",
|
||||
"cross-env": "^7.0.3",
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
// limitations under the License.
|
||||
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
||||
const { appendFileSync } = require('fs');
|
||||
|
||||
module.exports = config => {
|
||||
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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue