Files
pnpm/exec
Eyal Mizrachi bb724a06ca fix(lifecycle): ensure target dir exists, use idiomatic ENOENT guard
Two follow-ups from the upstream CI run on canora.11:

1. `mirrorFilesIntoTarget` only mkdir'd intermediate sub-directories
   (collected via `path.dirname(relPath)`), so any workspace package with
   only top-level files (e.g. `main.js`) ended up calling unlinkSync
   against a path whose parent target dir didn't exist yet — failing
   three pre-existing `inject local packages and relink them after build`
   tests on Linux. Pre-create the target dir itself before the sub-dir
   loop so top-level relPaths are covered.

2. The catch around unlinkSync used `err instanceof Error` to narrow
   before reading `.code`. That check is unreliable across bundler /
   realm boundaries (the bundled pnpm CLI is one artifact running under
   Node's experimental-vm-modules in tests, where Error identity can
   diverge). Match the pattern used elsewhere in the pnpm tree
   (bins.linker, modules-yaml, bins.resolver) and cast directly to
   `NodeJS.ErrnoException`, which is what those call sites do.

Also corrects the bin-having-dep regression test to use `prepare`
(which pnpm runs during install) instead of `prepublishOnly` (only
fires during publish). The original test name is unchanged — the test
still asserts the same behaviour, just with a lifecycle script that
actually runs in the install path being tested.
2026-05-15 06:06:44 -04:00
..
2026-05-14 13:31:53 +02:00
2026-05-14 13:31:53 +02:00