-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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): link and run own bins directly when possible #5848
base: latest
Are you sure you want to change the base?
Conversation
1097d99
to
d5c777f
Compare
This follows a similar approach to local and global bins that already exist. This is achieved by linking a packages own bin script to `node_modules/.bin` and the package within `node_modules/` similar to if it had been installed with `--install-links=false`. Then the linked bin is run and the symlinks are cleaned up immediately after. This has the same effect as loading the current package into the `npx` cache and running it, except it is quicker to not have to run any Arborist commands.
b3d744b
to
20eb746
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah let's try it this way.
i have a couple of concerns with how this works, but also ideas about how to take this further and make it more reliable
to address these problems, here's what i'm thinking:
if we take this path, then not only do we resolve the issue at hand, but we ensure there is no chance of collisions in either the directory name or the bin name. note, however, that doing this also means that we complicate the |
@nlf that sounds like a good plan. I had attempted to address those issues in the initial PR but in the case of the conflicting bins, it would not link the local bin and instead use the original refified bin. I thought this would be required to maintain backwards compatability, but that's actually not true. I converted this to a draft and pulled out the chores into #5902 and #5908. Once those land, I will take another look at the approach outlined above. |
This is an alternative to #5842. I had pushed some commits to that PR but backed them out to make it clear that this is a different approach to the same issue.
This also includes two chore commits to refactor the tests. If the
fix:
from this PR doesn't get merged, I will make a few PR with only those chores.Here is the relevant message from the
fix
commit:Commits: