diff --git a/packages/nx/src/utils/project-graph-utils.ts b/packages/nx/src/utils/project-graph-utils.ts index 75ac82ffbe5364..a8f04391c89777 100644 --- a/packages/nx/src/utils/project-graph-utils.ts +++ b/packages/nx/src/utils/project-graph-utils.ts @@ -10,11 +10,7 @@ export function projectHasTarget( project: ProjectGraphProjectNode, target: string ) { - return !!( - project.data && - project.data.targets && - project.data.targets[target] - ); + return !!project?.data?.targets?.[target]; } export function projectHasTargetAndConfiguration( @@ -24,17 +20,12 @@ export function projectHasTargetAndConfiguration( ) { return ( projectHasTarget(project, target) && - project.data.targets[target].configurations && - project.data.targets[target].configurations[configuration] + project.data.targets[target].configurations?.[configuration] ); } export function projectHasTag(project: ProjectGraphProjectNode, tag: string) { - return !!( - project.data && - project.data.tags && - project.data.tags.includes(tag) - ); + return !!project?.data?.tags?.includes(tag); } export function mergeNpmScriptsWithTargets(