Skip to content

Commit

Permalink
fix(core): allow postTaskExecution hook without preTaskExecution hook (
Browse files Browse the repository at this point in the history
…#29820)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

`postTaskExecution` hook is only called if `preTaskExecution` hook is
exported in the plugin.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

`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)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

Fixed `postTaskExecution` hook

Co-authored-by: Jonathan Cammisuli <[email protected]>
  • Loading branch information
HaasStefan and Cammisuli authored Jan 31, 2025
1 parent ed1dd5f commit cdd4958
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/nx/src/project-graph/plugins/loaded-nx-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit cdd4958

Please sign in to comment.