Skip to content

Commit

Permalink
fix(release): ensure nx release publish --graph only includes proje…
Browse files Browse the repository at this point in the history
…cts with target (#21726)

(cherry picked from commit 114faf8)
  • Loading branch information
JamesHenry authored and FrozenPandaz committed Feb 9, 2024
1 parent 1c161c6 commit 342ce28
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/nx/src/command-line/release/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,27 +162,30 @@ async function runPublishOnProjects(
overrides.firstRelease = args.firstRelease;
}

const targets = ['nx-release-publish'];
const requiredTargetName = 'nx-release-publish';

if (args.graph) {
const file = readGraphFileFromGraphArg(args);
const projectNames = projectsToRun.map((t) => t.name);
const projectNamesWithTarget = projectsToRun
.map((t) => t.name)
.filter((projectName) =>
projectHasTarget(projectGraph.nodes[projectName], requiredTargetName)
);
await generateGraph(
{
watch: false,
all: false,
open: true,
view: 'tasks',
targets,
projects: projectNames,
targets: [requiredTargetName],
projects: projectNamesWithTarget,
file,
},
projectNames
projectNamesWithTarget
);
return 0;
}

const requiredTargetName = 'nx-release-publish';
const projectsWithTarget = projectsToRun.filter((project) =>
projectHasTarget(project, requiredTargetName)
);
Expand All @@ -205,7 +208,7 @@ async function runPublishOnProjects(
projectGraph,
{ nxJson },
{
targets,
targets: [requiredTargetName],
outputStyle: 'static',
...(args as any),
},
Expand Down

0 comments on commit 342ce28

Please sign in to comment.