From 11fec5a4e8d97acbd62035f47f687c7d637c79af Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Thu, 2 May 2024 17:20:07 +0100 Subject: [PATCH] fix(devkit): run callback for forEachProjectConfig when target.options is undefined (#23143) ## Current Behavior `forEachExecutorOptions` will not run the callback if `target.options` is undefined. This means that even if a target exists with an executor, the target is not being processed if it does not have `options`. ## Expected Behavior Run the callback anyway even if `target.options` is undefined ## Related Issue(s) Fixes # --- .../migrations/update-16-1-0/update-server-executor-config.ts | 4 ++-- packages/devkit/src/generators/executor-options-utils.ts | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/angular/src/migrations/update-16-1-0/update-server-executor-config.ts b/packages/angular/src/migrations/update-16-1-0/update-server-executor-config.ts index 4e120baf847cc..e3c1d06341ea1 100644 --- a/packages/angular/src/migrations/update-16-1-0/update-server-executor-config.ts +++ b/packages/angular/src/migrations/update-16-1-0/update-server-executor-config.ts @@ -30,8 +30,8 @@ export default async function (tree: Tree) { : projectConfiguration.targets[targetName].options; if ( - configToUpdate.buildOptimizer === undefined && - configToUpdate.optimization !== undefined + configToUpdate?.buildOptimizer === undefined && + configToUpdate?.optimization !== undefined ) { configToUpdate.buildOptimizer = !!configToUpdate.optimization; } diff --git a/packages/devkit/src/generators/executor-options-utils.ts b/packages/devkit/src/generators/executor-options-utils.ts index 9a65203e3d7e2..b10ad540496cf 100644 --- a/packages/devkit/src/generators/executor-options-utils.ts +++ b/packages/devkit/src/generators/executor-options-utils.ts @@ -55,9 +55,7 @@ function forEachProjectConfig( continue; } - if (target.options) { - callback(target.options, projectName, targetName); - } + callback(target.options ?? {}, projectName, targetName); if (!target.configurations) { continue;