fix(js): identify correct circular dependecies (#29759)
This commit is contained in:
parent
51a0bae574
commit
1047991200
@ -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} 📄 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} 📄 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} ✍️ 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}",
|
"name": "@proj/{project-name}",
|
||||||
|
|||||||
@ -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)
|
const allDependentProjects = Object.values(localPackageDependencies)
|
||||||
.flat()
|
.flat()
|
||||||
.filter((localPackageDependency) => {
|
.filter((localPackageDependency) => {
|
||||||
return localPackageDependency.target === project.name;
|
return localPackageDependency.target === projectName;
|
||||||
});
|
});
|
||||||
|
|
||||||
const includeTransitiveDependents =
|
const includeTransitiveDependents =
|
||||||
@ -643,10 +643,14 @@ To fix this you will either need to add a package.json file at that location, or
|
|||||||
const dependentProjectsOutsideCurrentBatch = [];
|
const dependentProjectsOutsideCurrentBatch = [];
|
||||||
// Track circular dependencies using value of project1:project2
|
// Track circular dependencies using value of project1:project2
|
||||||
const circularDependencies = new Set<string>();
|
const circularDependencies = new Set<string>();
|
||||||
|
const projectsDependOnCurrentProject =
|
||||||
|
localPackageDependencies[projectName]?.map(
|
||||||
|
(localPackageDependencies) => localPackageDependencies.target
|
||||||
|
) ?? [];
|
||||||
|
|
||||||
for (const dependentProject of allDependentProjects) {
|
for (const dependentProject of allDependentProjects) {
|
||||||
// Track circular dependencies (add both directions for easy look up)
|
// Track circular dependencies (add both directions for easy look up)
|
||||||
if (dependentProject.target === projectName) {
|
if (projectsDependOnCurrentProject.includes(dependentProject.source)) {
|
||||||
circularDependencies.add(
|
circularDependencies.add(
|
||||||
`${dependentProject.source}:${dependentProject.target}`
|
`${dependentProject.source}:${dependentProject.target}`
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user