michael faith f63520bc42 fix(@angular-devkit/schematics): running external schematics with yarn pnp
This change addresses an issue encountered when running external schematics from
a yarn pnp workspace.  The function used to resolve a collection json using node
used recursion in a way that it effectively walked itself into an exception. Then,
if the exception is the type it expected, it would keep going.  This was flawed
in that yarn with pnp throws a different type of error when it failed to load
the mis-constructed collection path
(e.g. `/node_modules/@schematics/angular/collection.json/package.json`).
`ENOTDIR` instead of `MODULE_NOT_FOUND`.

This process of intentionally / knowingly walking into an exception seems problematic in
general.  So, I addressed it by first checking if the `schematics` entry in the package
is a relative path.  If it is, then don't construct the collection path from that.
If entry is not relative, then assume it's pointing at another package and we need
to recurse to get to the actual collection path.

I've tested this in both yarn pnp and non-pnp environments.
2023-10-31 08:59:41 +01:00
..
2021-04-28 16:05:49 -07:00