Skip to content

Commit

Permalink
fix(core): targets referred to by targetDependencies should be option…
Browse files Browse the repository at this point in the history
…al by default
  • Loading branch information
AgentEnder committed Mar 15, 2022
1 parent 9c25cd9 commit a6983ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/workspace/src/tasks-runner/run-command.ts
Expand Up @@ -3,6 +3,7 @@ import { join } from 'path';
import { appRootPath } from 'nx/src/utils/app-root';
import type {
NxJsonConfiguration,
ProjectConfiguration,
ProjectGraph,
ProjectGraphProjectNode,
TargetDependencyConfig,
Expand Down Expand Up @@ -347,7 +348,7 @@ export function createTask({
}

function addTasksForProjectDependencyConfig(
project: ProjectGraphProjectNode,
project: ProjectGraphProjectNode<ProjectConfiguration>,
{
target,
configuration,
Expand Down Expand Up @@ -387,10 +388,9 @@ function addTasksForProjectDependencyConfig(
const depProject = projectGraph.nodes[
dep.target
] as ProjectGraphProjectNode;
if (
depProject &&
projectHasTarget(depProject, dependencyConfig.target)
) {
const hasTarget =
depProject && projectHasTarget(depProject, dependencyConfig.target);
if (depProject && hasTarget) {
addTasksForProjectTarget(
{
project: depProject,
Expand Down Expand Up @@ -428,7 +428,7 @@ function addTasksForProjectDependencyConfig(
}
}
}
} else {
} else if (project.data.targets[dependencyConfig.target]) {
addTasksForProjectTarget(
{
project,
Expand Down
5 changes: 4 additions & 1 deletion packages/workspace/src/tasks-runner/task-graph-creator.ts
Expand Up @@ -55,7 +55,10 @@ export class TaskGraphCreator {
for (const t of tasks) {
if (
t.target.project === task.target.project &&
t.target.target === dependencyConfig.target
t.target.target === dependencyConfig.target &&
this.projectGraph.nodes[t.target.project]?.data?.targets[
t.target.target
]
) {
graph.dependencies[task.id].push(t.id);
}
Expand Down

0 comments on commit a6983ad

Please sign in to comment.