nx/scripts/depcheck/discrepancies.ts
Colum Ferry 0872f01738
feat(angular): allow custom webpack config support for webpack-browse… (#5609)
* feat(angular): allow custom webpack config support for webpack-browser builds

Allow building with a custom webpack config when using webpack-browser builds

* cleanup(angular): have buildApp function determine what builder to use

have buildApp function determine what builder to use keeping run function cleaner

* chore(misc): add IGNORE_MATCHES to CI dep discrepancy check

Add option to ignore packages in the discrepancy check for CI

* cleanup(angular): throw schematic error when webpack config path incorrect

Throw a helpful error when the user supplies an incorrect custom webpack config file path
2021-05-18 16:05:17 +01:00

32 lines
820 B
TypeScript

import * as chalk from 'chalk';
import { satisfies } from 'semver';
// Ignore packages that are defined here per package
const IGNORE_MATCHES = {
'*': [],
angular: ['webpack-merge'],
};
export default function getDiscrepancies(
name: string,
projectDependencies: JSON,
devDependencies: JSON
) {
return Object.keys(projectDependencies)
.filter((p) => !p.startsWith('@nrwl/'))
.filter((p) =>
!IGNORE_MATCHES['*'].includes(p) && IGNORE_MATCHES[name]
? !IGNORE_MATCHES[name].includes(p)
: true
)
.filter(
(p) =>
devDependencies[p] &&
projectDependencies[p] !== devDependencies[p] &&
!satisfies(devDependencies[p], projectDependencies[p])
)
.map(
(p) => `${p}@${devDependencies[p]} ${chalk.dim(projectDependencies[p])}`
);
}