This previously double incremented `resultHeight`. When writing this,
I was thinking the child node's height was 1 more than the call for its
dependencies. The parent node (the result) would then be more more than
that.
However, `resultHeight`'s definition is based the longest edge in the
dependencies array returned, which doesn't include the parent node. The
additional `+ 1` to account for the parent node should never have been
added.
In a debugger, I noticed a test package with no dependencies return a
height of `0` from getTree. By the comment in `DependencyInfo`, this
should instead be `null` since the dependencies array is empty.
It turns out this is the case when `deps == null`. The `getTree`
function early returns with a `null` height:
```ts
if (deps == null) {
return { dependencies: [], isPartiallyVisited: false, height: null }
}
```
However, when `deps` is `{}`, `resultHeight` gets initialized to `0`.
The subsequent `.forEach` loop then iterates over the non-empty object.
* test(dependencies-hierarchy): start currentDepth at 1 in tests
Calls to `getTree` from the `buildDependenciesHierarchy` function always
start the `currentDepth` at `1` rather than `0`.
Updating `currentDepth` calls in test to also start at `1` for
consistency with production code. This required incrementing the
`maxDepth` argument in a few cases as well.
* refactor(dependencies-hierarchy): simplify max depth recursion
Add the `description`-field to the output of the `licenses list`-command so that
for each package the description in the package manifest gets listed too
Currently, when `node-linker=hoisted` is used and `node_modules` is not up-to-date, pnpm relinks all dependencies inside node_modules. This is not efficient, so with this optimisation pnpm will only relink what needs to be relinked.
* fix: improve license file reading logic
If the file index is of the appropriate type so we can leverage the contents of `PackageFileInfo`-type we try
to lookup the file mode to and pass it to the `readLicenseFileFromCafs`-function so it can be correctly
passed to the underlying `getFilePathByModeInCafs`-function responsible for fetching the file from
the PNPM store
* test: add integration test for the problematic `svgicons2svgfont`
Added a test to verify that the LICENSE files of the `svgicons2svgfont@5.0.2`-package
and similar packages can be read without errors
* refactor: license
* docs: add changesets
Co-authored-by: Weyert de Boer <weyert@innerfuse.biz>
Co-authored-by: Zoltan Kochan <z@kochan.io>