Skip to content

Commit d646721

Browse files
alan-agius4dherges
authored andcommitted
perf: speed up discovery of secondary entry points (#930)
`node_modules` were still being scanned as the folder was not being ignored. Closes #921
1 parent 886ce51 commit d646721

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/lib/ng-v5/discover-packages.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,18 @@ const primaryEntryPoint = ({ packageJson, ngPackageJson, basePath }: UserPackage
8686
* @param excludeFolder A sub-folder of `directoryPath` that is excluded from search results.
8787
*/
8888
const findSecondaryPackagesPaths = async (directoryPath: string, excludeFolder: string): Promise<string[]> => {
89-
const excludedFolders = ['node_modules', 'dist', path.resolve(directoryPath, excludeFolder)];
90-
91-
const EXCLUDE_FOLDERS = [];
92-
for (let folder of excludedFolders) {
93-
EXCLUDE_FOLDERS.push(`**/${folder}/**/package.json`, `**/${folder}/**/ng-package.json`);
94-
}
95-
EXCLUDE_FOLDERS.push(`${directoryPath}/package.json`, `${directoryPath}/ng-package.json`);
89+
const ignore = [
90+
'**/node_modules/**/*',
91+
`${path.resolve(directoryPath, excludeFolder)}/**/*`,
92+
`${directoryPath}/package.json`
93+
];
9694

9795
const filePaths = await globFiles(`${directoryPath}/**/package.json`, {
98-
ignore: EXCLUDE_FOLDERS,
96+
ignore,
9997
cwd: directoryPath
10098
});
101-
return filePaths.map(path.dirname).filter((value, index, array) => array.indexOf(value) === index);
99+
100+
return filePaths.map(path.dirname);
102101
};
103102

104103
/**

0 commit comments

Comments
 (0)