-
Notifications
You must be signed in to change notification settings - Fork 5
Minor depth calculation fixes #3
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3 +/- ##
============================================
- Coverage 99.65% 99.65% -0.01%
+ Complexity 121 120 -1
============================================
Files 3 3
Lines 290 289 -1
============================================
- Hits 289 288 -1
Misses 1 1
Continue to review full report at Codecov.
|
1 similar comment
|
Thank you for your contribution. Calculating depths without a set of root dependencies generally will return wrong results. Consider the following example: {
"dependencies": {
"prop-types": "^15.6.2",
"react": "^16.7.0"
}
}Usually we will assume all packages that are not required by other packages in the Admittedly I accept the other changes you proposed, but I insist on having any kind of explanation in the readme regarding the "need" for $yarnLock->getPackagesByDepth(0); // 'react'
$yarnLock->resetDepth();
$yarnLock->calculateDepth(
array_map(
function($name) use ($yarnLock) {
return $yarnLock->getPackagesByName($name)[0];
},
['react', 'prop-types']
)
);
$yarnLock->getPackagesByDepth(0); // 'react', 'prop-types' |
Hi! Thanks for creating this package, it's really useful!
bbe2e0e fixes an issue where
calculateDepth()(with no roots) fails becauseresolves = null. The check forcount($p->getResolves())always fails, becauseresolvescouldn't ever be an empty array (it's eithernullor non-empty).aa463f0 just ensures
calculateDepth()has run when you usegetPackagesByDepth(). Otherwise, the latter always returns an empty array. (getDepth()already does the same.)5558b05 and 3c77397 are readme fixes. It seems like the readme was outdated, maybe? There's no need to parse
package.json, and just doinggetPackagesByDepth(0)works fine for me.