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(js): identify correct circular dependecies #29759

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e/release/src/independent-projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ describe('nx release - independent projects', () => {
{project-name} 📄 Resolved the current version as 0.0.0 from {project-name}/package.json
{project-name} 📄 Using the provided version specifier "999.9.9-package.3".
{project-name} ✍️ New version 999.9.9-package.3 written to {project-name}/package.json
{project-name} ✍️ Applying new version 999.9.9-package.3 to 1 package which depends on {project-name}


"name": "@proj/{project-name}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ To fix this you will either need to add a package.json file at that location, or
const allDependentProjects = Object.values(localPackageDependencies)
.flat()
.filter((localPackageDependency) => {
return localPackageDependency.target === project.name;
return localPackageDependency.target === projectName;
});

const includeTransitiveDependents =
Expand All @@ -643,10 +643,14 @@ To fix this you will either need to add a package.json file at that location, or
const dependentProjectsOutsideCurrentBatch = [];
// Track circular dependencies using value of project1:project2
const circularDependencies = new Set<string>();
const projectsDependOnCurrentProject =
localPackageDependencies[projectName]?.map(
(localPackageDependencies) => localPackageDependencies.target
) ?? [];

for (const dependentProject of allDependentProjects) {
// Track circular dependencies (add both directions for easy look up)
if (dependentProject.target === projectName) {
if (projectsDependOnCurrentProject.includes(dependentProject.source)) {
circularDependencies.add(
`${dependentProject.source}:${dependentProject.target}`
);
Expand Down
Loading