Skip to content

Conversation

wraithgar
Copy link
Member

@wraithgar wraithgar commented Nov 10, 2022

npx still thought it had to translate the bin name after it found one in the local package.

Closes #5777
again

@wraithgar wraithgar requested a review from a team as a code owner November 10, 2022 15:13
@wraithgar wraithgar force-pushed the gar/npx-self-reference branch from de19291 to c9d4fb1 Compare November 10, 2022 15:13
@wraithgar wraithgar changed the title gar/npx self reference fix(npx): properly look for local bins when there are more than one Nov 10, 2022
@wraithgar wraithgar force-pushed the gar/npx-self-reference branch from c9d4fb1 to b029de6 Compare November 10, 2022 15:15
@lukekarrys
Copy link
Contributor

lukekarrys commented Nov 11, 2022

Edit: I opened #5848 instead of fixing up this branch. Only one of this PR and #5848 should be landed in the current form.


I pushed some fixups to this branch with an idea I had and I think it works? It's my first time working in libnpmexec, so correct me if I'm wrong here.

I attempted to make the logic for the local manifest lookup the same as the logic for local and global bins.

So it no longer does any arborist.loadActual() calls and instead calls the bin file directly if it exists via the @npmcli/run-script call option. This made it go from ~2.5s to ~0.7s to call a mostly empty bin script.

@lukekarrys lukekarrys marked this pull request as draft November 12, 2022 04:33
@lukekarrys lukekarrys force-pushed the gar/npx-self-reference branch 3 times, most recently from b58a0bc to a7d4af4 Compare November 12, 2022 04:53
@lukekarrys lukekarrys force-pushed the gar/npx-self-reference branch from a7d4af4 to 7deac75 Compare November 12, 2022 04:59
@lukekarrys lukekarrys force-pushed the gar/npx-self-reference branch from 7deac75 to 903b695 Compare November 12, 2022 20:35
@lukekarrys lukekarrys marked this pull request as ready for review November 12, 2022 21:23
@wraithgar wraithgar closed this Nov 15, 2022
@wraithgar wraithgar reopened this Nov 16, 2022
@wraithgar wraithgar merged commit cc0ad27 into latest Nov 16, 2022
@wraithgar wraithgar deleted the gar/npx-self-reference branch November 16, 2022 19:14
@github-actions github-actions bot mentioned this pull request Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] exec/npx: npm v8.8+/9+ break with a self-reference
3 participants