Skip to content

Commit

Permalink
fix(release): propagate release for dependent packages
Browse files Browse the repository at this point in the history
Propagate release for all dependant packages that need updating when projectRelationship is "independent" .
Fixes nrwl#22268
  • Loading branch information
mpetrovic-sm committed Mar 25, 2024
1 parent 9520aa2 commit 0040d75
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
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
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

0 comments on commit 0040d75

Please sign in to comment.