Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(release): ensure nx release publish --graph only includes projects with target #21726

Merged
merged 4 commits into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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