Skip to content

Commit 1d2ea79

Browse files
committed
refactor(@angular/build): run initialization tasks concurrently in library builder
Moving target project name validation before async operations allows early exit if missing. Additionally, normalizing library options, initializing xxHash, and purging the stale build disk cache concurrently via Promise.all avoids serial awaiting during builder startup.
1 parent dcf906a commit 1d2ea79

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • packages/angular/build/src/builders/library

‎packages/angular/build/src/builders/library/builder.ts‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ export async function* executeLibraryBuilder(
4242
context: BuilderContext & { signal?: AbortSignal },
4343
): AsyncIterableIterator<BuilderOutput> {
4444
assertCompatibleAngularVersion(context.workspaceRoot);
45-
await initializeHash();
46-
47-
// Purge old build disk cache
48-
await purgeStaleBuildCache(context);
4945

5046
const projectName = context.target?.project;
5147
if (!projectName) {
@@ -54,7 +50,13 @@ export async function* executeLibraryBuilder(
5450
return;
5551
}
5652

57-
const normalizedOptions = await normalizeLibraryOptions(context, projectName, options);
53+
const [normalizedOptions] = await Promise.all([
54+
normalizeLibraryOptions(context, projectName, options),
55+
initializeHash(),
56+
// Purge old build disk cache
57+
purgeStaleBuildCache(context),
58+
]);
59+
5860
const {
5961
workspaceRoot,
6062
projectRoot,

0 commit comments

Comments
 (0)