mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore(travis-ci): add circular references check (#7754)
This commit is contained in:
committed by
Manol Donev
parent
268a193de6
commit
d479067afb
10
.travis.yml
10
.travis.yml
@@ -1,5 +1,13 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "node"
|
||||
script:
|
||||
- cd tns-core-modules && npm i && cd ..
|
||||
# circular references check
|
||||
- cd tests && npm i
|
||||
- node_modules/.bin/webpack --env.android
|
||||
- node_modules/.bin/webpack --env.ios
|
||||
# modules transpilation
|
||||
- cd ../tns-core-modules && npm i && cd ..
|
||||
- npm install
|
||||
- npm run tsc
|
||||
- npm run tslint
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"tns-core-modules": "file:../tns-core-modules"
|
||||
},
|
||||
"devDependencies": {
|
||||
"circular-dependency-plugin": "5.2.0",
|
||||
"nativescript-dev-webpack": "next",
|
||||
"node-sass": "^4.12.0",
|
||||
"tns-platform-declarations": "file:../tns-platform-declarations",
|
||||
|
||||
@@ -3,6 +3,7 @@ const { join, relative, resolve, sep } = require("path");
|
||||
const webpack = require("webpack");
|
||||
const nsWebpack = require("nativescript-dev-webpack");
|
||||
const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
|
||||
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
||||
const CleanWebpackPlugin = require("clean-webpack-plugin");
|
||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
@@ -11,6 +12,10 @@ const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeS
|
||||
const TerserPlugin = require("terser-webpack-plugin");
|
||||
const hashSalt = Date.now().toString();
|
||||
|
||||
const ANDROID_MAX_CYCLES = 68;
|
||||
const IOS_MAX_CYCLES = 39;
|
||||
let numCyclesDetected = 0;
|
||||
|
||||
module.exports = env => {
|
||||
// Add your custom Activities, Services and other Android app components here.
|
||||
const appComponents = [
|
||||
@@ -230,6 +235,32 @@ module.exports = env => {
|
||||
"global.TNS_WEBPACK": "true",
|
||||
"process": "global.process",
|
||||
}),
|
||||
new CircularDependencyPlugin({
|
||||
onStart({ compilation }) {
|
||||
console.log('start detecting webpack modules cycles');
|
||||
numCyclesDetected = 0;
|
||||
},
|
||||
onDetected({ module: webpackModuleRecord, paths, compilation }) {
|
||||
numCyclesDetected++;
|
||||
compilation.warnings.push(new Error(paths.join(' -> ')))
|
||||
},
|
||||
onEnd({ compilation }) {
|
||||
console.log('end detecting webpack modules cycles');
|
||||
if (platform === "android" && numCyclesDetected !== ANDROID_MAX_CYCLES) {
|
||||
compilation.errors.push(new Error(
|
||||
`Detected ${numCyclesDetected} cycles which differs configured limit of ${ANDROID_MAX_CYCLES}.`
|
||||
));
|
||||
} else if (platform === "ios" && numCyclesDetected !== IOS_MAX_CYCLES) {
|
||||
compilation.errors.push(new Error(
|
||||
`Detected ${numCyclesDetected} cycles which differs configured limit of ${IOS_MAX_CYCLES}.`
|
||||
));
|
||||
} else {
|
||||
compilation.warnings.push(new Error(
|
||||
`${numCyclesDetected} cycles detected.`
|
||||
));
|
||||
}
|
||||
},
|
||||
}),
|
||||
// Remove all files from the out dir.
|
||||
new CleanWebpackPlugin(itemsToClean, { verbose: !!verbose }),
|
||||
// Copy assets to out dir. Add your own globs as needed.
|
||||
|
||||
Reference in New Issue
Block a user