Skip to content

Commit

Permalink
build: refactor circular-deps-test.conf to use package.js file
Browse files Browse the repository at this point in the history
This ensures that all packages are picked up.

(cherry picked from commit 71731f2)
  • Loading branch information
alan-agius4 committed Feb 24, 2023
1 parent cdc7c22 commit adb92ac
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions packages/circular-deps-test.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

const fs = require('fs');
const path = require('path');
const { packages } = require('../lib/packages');

module.exports = {
baseDir: '../',
Expand All @@ -22,26 +23,14 @@ module.exports = {
* Custom module resolver that maps specifiers for local packages folder.
* This ensures that cross package/entry-point dependencies can be detected.
*/
const LOCAL_MAPPINGS = [
['@angular-devkit/build-angular', 'angular_devkit/build_angular'],
['@angular-devkit/architect', 'angular_devkit/architect'],
['@angular-devkit/architect-cli', 'angular_devkit/architect_cli'],
['@angular-devkit/benchmark', 'angular_devkit/benchmark'],
['@angular-devkit/build-webpack', 'angular_devkit/build_webpack'],
['@angular-devkit/core', 'angular_devkit/core'],
['@angular-devkit/schematics', 'angular_devkit/schematics'],
['@angular-devkit/schematics-cli', 'angular_devkit/schematics_cli'],
['@angular/cli', 'angular/cli'],
['@schematics/angular', 'schematics/angular'],
['@ngtools/webpack', 'ngtools/webpack'],
];
const LOCAL_MAPPINGS = Object.entries(packages).map(([name, pkg]) => [name, pkg.root]);

function resolveModule(specifier) {
let localSpecifierPath;

for (const [key, value] of LOCAL_MAPPINGS) {
if (specifier.startsWith(key)) {
localSpecifierPath = path.join(__dirname, specifier.replace(key, value));
localSpecifierPath = specifier.replace(key, value);
break;
}
}
Expand Down

0 comments on commit adb92ac

Please sign in to comment.