@lerna/query-graph
Advanced tools
Comparing version 3.14.0 to 3.16.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.16.0](https://github.com/lerna/lerna/compare/v3.15.0...v3.16.0) (2019-07-18) | ||
### Bug Fixes | ||
* **package-graph:** Flatten cycles to avoid skipping packages ([#2185](https://github.com/lerna/lerna/issues/2185)) ([b335763](https://github.com/lerna/lerna/commit/b335763)) | ||
# [3.14.0](https://github.com/lerna/lerna/compare/v3.13.4...v3.14.0) (2019-05-14) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@lerna/query-graph", | ||
"version": "3.14.0", | ||
"version": "3.16.0", | ||
"description": "An internal Lerna tool", | ||
@@ -34,6 +34,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@lerna/package-graph": "3.14.0", | ||
"@lerna/package-graph": "3.16.0", | ||
"figgy-pudding": "^3.5.1" | ||
}, | ||
"gitHead": "39da145c67ea587457694f318f32f967b9d66ea9" | ||
"gitHead": "8ca18bedecf4f141c6242a099086e84b2ced72de" | ||
} |
@@ -29,10 +29,3 @@ "use strict"; | ||
// Evaluate cycles | ||
[this.cyclePaths, this.cycleNodes] = this.graph.partitionCycles(options.rejectCycles); | ||
if (this.cyclePaths.size) { | ||
// Find the cyclical package with the most dependents. Will be evaluated before other cyclical packages | ||
this.cyclicalPackageWithMostDependents = Array.from(this.cycleNodes) | ||
.sort((a, b) => b.localDependents.size - a.localDependents.size) | ||
.shift(); | ||
} | ||
this.cycles = this.graph.collapseCycles(options.rejectCycles); | ||
} | ||
@@ -45,18 +38,11 @@ | ||
_getNextCycle() { | ||
// If the cyclical package with the most dependents is still in the graph, we return it | ||
if (this.graph.has(this.cyclicalPackageWithMostDependents.name)) { | ||
return [this.graph.get(this.cyclicalPackageWithMostDependents.name)]; | ||
const cycle = Array.from(this.cycles).find(cycleNode => cycleNode.localDependencies.size === 0); | ||
if (!cycle) { | ||
return []; | ||
} | ||
// Otherwise, return any package that does not depend on the package referenced above | ||
return Array.from(this.graph.values()).filter( | ||
node => !node.localDependencies.has(this.cyclicalPackageWithMostDependents) | ||
); | ||
} | ||
this.cycles.delete(cycle); | ||
_onlyCyclesLeft() { | ||
// Check if every remaining package is a package from the cycleNodes graph | ||
return Array.from(this.graph.values()).every(node => | ||
Array.from(this.cycleNodes).some(cycleNode => cycleNode.name === node.name) | ||
); | ||
return cycle.flatten(); | ||
} | ||
@@ -72,8 +58,3 @@ | ||
// Or, get the next cyclical packages | ||
if (this.cyclePaths.size && this._onlyCyclesLeft()) { | ||
return this._getNextCycle(); | ||
} | ||
return []; | ||
return this._getNextCycle(); | ||
} | ||
@@ -87,2 +68,6 @@ | ||
this.graph.remove(candidateNode); | ||
for (const cycle of this.cycles) { | ||
cycle.unlink(candidateNode); | ||
} | ||
} | ||
@@ -89,0 +74,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5521
80
+ Added@lerna/package-graph@3.16.0(transitive)
+ Added@lerna/prerelease-id-from-version@3.16.0(transitive)
+ Addedsemver@6.3.1(transitive)
- Removed@lerna/package-graph@3.14.0(transitive)
- Removed@lerna/prerelease-id-from-version@3.14.0(transitive)
Updated@lerna/package-graph@3.16.0