From c371b2a492c60f47ce6b96b4df129c5d01706e1b Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:23:39 -0800 Subject: fix(install): re-setup bin entries after running lifecycle scripts (#26752) Fixes #26677 Some packages (like supabase) declare bin entries that don't exist until lifecycle scripts are run. For instance, the lifecycle script downloads a binary file which serves as a bin entrypoint. Unfortunately you can't just defer setting up the bin entries until after lifecycle scripts have run, because the scripts may rely on them. I looked into this, and PNPM just re-links bin entries after running lifecycle scripts. I think that's about the best we can do as well. Note that we'll only re-setup bin entries for packages whose lifecycle scripts we run. This should limit the performance cost, as typically a given project will not have many lifecycle scripts (and of those, many of them probably don't have bin entries to set up). --- .../npm/@denotest/bin-created-by-lifecycle/1.0.0/install.mjs | 3 +++ .../npm/@denotest/bin-created-by-lifecycle/1.0.0/package.json | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/registry/npm/@denotest/bin-created-by-lifecycle/1.0.0/install.mjs create mode 100644 tests/registry/npm/@denotest/bin-created-by-lifecycle/1.0.0/package.json (limited to 'tests/registry/npm/@denotest/bin-created-by-lifecycle/1.0.0') diff --git a/tests/registry/npm/@denotest/bin-created-by-lifecycle/1.0.0/install.mjs b/tests/registry/npm/@denotest/bin-created-by-lifecycle/1.0.0/install.mjs new file mode 100644 index 000000000..31020fcdf --- /dev/null +++ b/tests/registry/npm/@denotest/bin-created-by-lifecycle/1.0.0/install.mjs @@ -0,0 +1,3 @@ +import * as fs from "node:fs"; + +fs.writeFileSync("./testbin.js", "#!/usr/bin/env node\nconsole.log('run testbin');"); \ No newline at end of file diff --git a/tests/registry/npm/@denotest/bin-created-by-lifecycle/1.0.0/package.json b/tests/registry/npm/@denotest/bin-created-by-lifecycle/1.0.0/package.json new file mode 100644 index 000000000..ad8dea002 --- /dev/null +++ b/tests/registry/npm/@denotest/bin-created-by-lifecycle/1.0.0/package.json @@ -0,0 +1,10 @@ +{ + "name": "@denotest/bin-created-by-lifecycle", + "version": "1.0.0", + "scripts": { + "install": "node install.mjs" + }, + "bin": { + "testbin": "testbin.js" + } +} \ No newline at end of file -- cgit v1.2.3