Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(npx): properly look for local bins when there are more than one #5842

Merged
merged 1 commit into from Nov 16, 2022

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 changed the title gar/npx self reference fix(npx): properly look for local bins when there are more than one Nov 10, 2022
@lukekarrys
Copy link
Member

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
@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