From cdd4958a992db06f0c3997a466c6ccff47a52df4 Mon Sep 17 00:00:00 2001 From: Stefan Haas Date: Fri, 31 Jan 2025 22:42:35 +0100 Subject: [PATCH] fix(core): allow postTaskExecution hook without preTaskExecution hook (#29820) ## Current Behavior `postTaskExecution` hook is only called if `preTaskExecution` hook is exported in the plugin. ## Expected Behavior `postTaskExecution` hook should be independent from `preTaskExecution` hook. I.e., if `preTaskExecution` hook is not exported, `postTaskExecution` hook should still be called after a task execution. ## Related Issue(s) Fixes # Fixed `postTaskExecution` hook Co-authored-by: Jonathan Cammisuli <4332460+Cammisuli@users.noreply.github.com> --- packages/nx/src/project-graph/plugins/loaded-nx-plugin.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nx/src/project-graph/plugins/loaded-nx-plugin.ts b/packages/nx/src/project-graph/plugins/loaded-nx-plugin.ts index 4dc715a1b2b49..c27cc5886c1b8 100644 --- a/packages/nx/src/project-graph/plugins/loaded-nx-plugin.ts +++ b/packages/nx/src/project-graph/plugins/loaded-nx-plugin.ts @@ -143,11 +143,11 @@ export class LoadedNxPlugin { } return updates; }; + } - if (plugin.postTasksExecution) { - this.postTasksExecution = async (context: PostTasksExecutionContext) => - plugin.postTasksExecution(this.options, context); - } + if (plugin.postTasksExecution) { + this.postTasksExecution = async (context: PostTasksExecutionContext) => + plugin.postTasksExecution(this.options, context); } } }