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): propagate release for dependent packages #22497

Closed
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export async function resolveSemverSpecifierFromConventionalCommits(
const relevantCommits = await getCommitsRelevantToProjects(
projectGraph,
parsedCommits,
projectNames
projectNames,
true
);
return determineSemverChange(relevantCommits, CONVENTIONAL_COMMITS_CONFIG);
}
Expand Down
20 changes: 18 additions & 2 deletions packages/nx/src/command-line/release/utils/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { prerelease } from 'semver';
import { ProjectGraph } from '../../../config/project-graph';
import { Tree } from '../../../generators/tree';
import { createFileMapUsingProjectGraph } from '../../../project-graph/file-map-utils';
import { findAllProjectNodeDependencies } from '../../../utils/project-graph-utils';
import { interpolate } from '../../../tasks-runner/utils';
import { output } from '../../../utils/output';
import type { ReleaseGroupWithName } from '../config/filter-release-groups';
Expand Down Expand Up @@ -288,11 +289,26 @@ export function handleDuplicateGitTags(gitTagValues: string[]): void {
export async function getCommitsRelevantToProjects(
projectGraph: ProjectGraph,
commits: GitCommit[],
projects: string[]
projects: string[],
includeInternalDependencies = false
): Promise<GitCommit[]> {
const relevantProjects = [...projects];
if (includeInternalDependencies) {
const projectDependencies = new Set<string>(
projects.reduce(
(deps, p) => [
...deps,
...findAllProjectNodeDependencies(p, projectGraph, false),
],
[] as string[]
)
);
relevantProjects.push(...projectDependencies);
}

const { fileMap } = await createFileMapUsingProjectGraph(projectGraph);
const filesInReleaseGroup = new Set<string>(
projects.reduce(
relevantProjects.reduce(
(files, p) => [...files, ...fileMap.projectFileMap[p].map((f) => f.file)],
[] as string[]
)
Expand Down