diff --git a/packages/nx/src/command-line/release/utils/resolve-semver-specifier.ts b/packages/nx/src/command-line/release/utils/resolve-semver-specifier.ts index 946cca4f45be3..81c3e7a06dafd 100644 --- a/packages/nx/src/command-line/release/utils/resolve-semver-specifier.ts +++ b/packages/nx/src/command-line/release/utils/resolve-semver-specifier.ts @@ -28,7 +28,8 @@ export async function resolveSemverSpecifierFromConventionalCommits( const relevantCommits = await getCommitsRelevantToProjects( projectGraph, parsedCommits, - projectNames + projectNames, + true ); return determineSemverChange(relevantCommits, CONVENTIONAL_COMMITS_CONFIG); } diff --git a/packages/nx/src/command-line/release/utils/shared.ts b/packages/nx/src/command-line/release/utils/shared.ts index 5993ede7ea9c9..3554ba70a2fdf 100644 --- a/packages/nx/src/command-line/release/utils/shared.ts +++ b/packages/nx/src/command-line/release/utils/shared.ts @@ -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'; @@ -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 { + const relevantProjects = [...projects]; + if (includeInternalDependencies) { + const projectDependencies = new Set( + projects.reduce( + (deps, p) => [ + ...deps, + ...findAllProjectNodeDependencies(p, projectGraph, false), + ], + [] as string[] + ) + ); + relevantProjects.push(...projectDependencies); + } + const { fileMap } = await createFileMapUsingProjectGraph(projectGraph); const filesInReleaseGroup = new Set( - projects.reduce( + relevantProjects.reduce( (files, p) => [...files, ...fileMap.projectFileMap[p].map((f) => f.file)], [] as string[] )