-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Inconsistency between tool installation #265
Comments
@rotu I think the confusion lies in the fact that there's 2 kinds of shims. There's the global shim at The local shims are a special case that need unique functionality. Right now its npm/pnpm/yarn because they require node to execute
|
This seems wrong though. Are you saying |
There's a fair bet I messed that observation up. Trying it now on a fresh Windows VM with npm and node installed via proto shows a global bin symlink for
That's definitely part of my confusion - until you mentioned it, I didn't even notice the local shims! Also, for some reason, on Windows, global shims are only The below observations are all on my Mac:
Note this is especially weird since
|
npx is also published by node. But I agree, this will probably change in the future.
npx isn't a proto tool, so using |
I think I'm missing something; I thought the whole reason to have a shim in the first place is to add it to the path.
I understand there is a technical reason why this works the way it does, but it seems arbitrary from a usage standpoint. E.g. I would expect |
Correct, but
We don't know what tool owns what shims without actually loading the plugin and executing the tool, which requires knowing the tool name ahead of time.
|
Okay. So what is this file for?
Gotcha. The original motivation behind this issue was that I was trying to understand what binaries It would be nice in general to have a command for introspecting tools (what shims does this tool provide? Which prototools/package.json/environment variable specified the tool version?) |
I explained it here: #265 (comment) If you compare the local and global shim, they're a bit different.
Yeah eventually there will be like a |
Here's my understanding. On Windows, the global npm shim is: @echo off
setlocal
set "ErrorActionPreference=Stop"
if defined PROTO_DEBUG (
set "DebugPreference=Continue"
)
proto.exe run npm -- %* This sets the Then (and this is the part I missed), proto launches a new PowerShell process to run the local shim. (I assumed that the binary proto/crates/cli/src/commands/run.rs Lines 127 to 155 in 4cbade4
The local Windows npm shim is: #!/usr/bin/env pwsh
$ErrorActionPreference = 'Stop'
if (Test-Path env:PROTO_DEBUG) {
$DebugPreference = 'Continue'
}
[Environment]::SetEnvironmentVariable('PROTO_NPM_DIR', '/tmp/proto_test\tools\npm\10.2.0', 'Process')
[Environment]::SetEnvironmentVariable('PROTO_NPM_VERSION', '10.2.0', 'Process')
if (Test-Path env:PROTO_NODE_BIN) {
$parent = $Env:PROTO_NODE_BIN
} else {
$parent = "node"
}
& "$parent" "/tmp/proto_test\tools\npm\10.2.0\bin/npm-cli.js" $args
exit $LASTEXITCODE This sets the variables Then it calls This is pretty hard to follow. My gut is that proto shouldn't be using PowerShell and internal shims like this. |
To start, the global shim triggers The local shim does not use
https://community.spiceworks.com/topic/686962-args-in-powershell#entry-4108731
What do you suggest? It's either |
There's still the overhead of starting a PowerShell. I'm not understanding why,
Oops. You're right -
I think I'm missing something pretty core here. In |
Mainly because it has to be generic enough to work for all tools that could possibly exist. All of this shim stuff has existed before plugins existed, so some of it is just legacy at this point. But as for Windows specifically, if we end up having to execute But yes, this is why proto is still a v0, as all of these features need to be ironed out. |
Okay, I think we're on the same page now. The scripts
Happy to put it through its paces! I appreciate so much the work you do! I want this tool to be awesome and to improve the state of software and I hope that comes across! This GitHub issue in particular is broadly written and not very clear. I think the main takeaways are (and I could split these out into separate issues):
|
I'm tinkering with some of this here: #268 |
This should be much more straight forward now in 0.22. |
I can see that:
I can see there's a little messiness in We also might want some clarifying language somewhere about the difference between a plugin, a tool, and a bin. I'm inferring the difference is:
At any rate, I think this issue can be closed as much less confusing now! |
I've updated the docs a bit to clarify the terminology. |
What version?
0.21.0
Which command?
No response
What happened?
How proto installs and refers to various executables is confusing and inconsistent:
node
exists as abin
symlink and a globalshims
script.npm
exists as abin
symlink but NOT a globalshims
.proto bin node
andproto bin node --shim
both show the versioned node executable.proto\tools\node\20.9.0\node.exe
.proto bin npm
shows me the versioned node.proto\tools\npm\10.1.0\bin/npm-cli.js
andproto bin npm --shim
shows me a powershell script.proto\tools\npm\10.1.0\shims\npm.ps1
proto bin npm
shows the path to the current npm.proto bin npx
fails with "npx is not a built-in tool or has not been configured as a plugin, unable to proceed."Any logs?
No response
Operating system?
Windows
Architecture?
x64
The text was updated successfully, but these errors were encountered: