Open NamPNQ opened 1 month ago
https://vfox.lhan.me/guides/quick-start.html#_5-switch-runtime
vfox
use config from three places:
$HOME/.version-fox/.tool-versions
$PWD/.tool-versions
$HOME/.version-fox/tmp/<shell-pid>/.tool-versions
The behavior of asdf will keep search up until reach /
To be honest, I don't like this strategy.
Just imagine you're in project, config .tool-versions
is stay in project/.tool-versions
. Then you go to child dir on your project, what you expected? You want use the right tools you already configured or any another version?
Then you go to child dir on your project, what you expected? You want use the right tools you already configured or any another version?
The current vfox
strategy is that if you have a .tool-version
in your project (project/.tool-versions
), that version will be used in the current shell, regardless of whether you switch directories or not, the version is not changed until the next .tool-versions
file is encountered, or vfox use
command is executed manually.
Maybe we don't understand each other Here is simple to reproduce what I mean
$ cd `mktemp -d`
$ mkdir -p proj/child
$ node -v # 20 for example
$ echo "nodejs 16.20.2" > proj/.tool-versions
$ vfox install nodejs@16.20.2
$ cd proj
$ node -v # 16 => its ok
$ cd child
$ node -v # 20 => its not ok => and this is unexpected behavior since another tools (asdf, nvmrc, pyenv...) always look at parent folder
$ cd `mktemp -d` $ mkdir -p proj/child $ node -v # 20 for example $ echo "nodejs 16.20.2" > proj/.tool-versions $ vfox install nodejs@16.20.2 $ cd proj $ node -v # 16 => its ok $ cd child $ node -v # 20 => its not ok => and this is unexpected behavior since another tools (asdf, nvmrc, pyenv...) always look at parent folder
Okay, it can indeed be reproduced.
@aooohan Your fix is not works if we go directly to child folder
@aooohan Your fix is not works if we go directly to child folder
I'm aware of this, and for this issue, I need to make sure that the behavior I described earlier is correct.
As I said earlier, I really don't like the strategy of keeping search up until reach /
.
Also, as for the situation you mentioned, I can't think of a case where it would go directly to a child folder of the project instead of the project root first.
I think navigate to child directory is a common practice, particularly in monorepo projects. Additionally, several other approaches exist, such as launch a new shell from the child directory
Describe the bug The behavior of
asdf
will keep search up until reach/
https://github.com/asdf-vm/asdf/blob/ccdd47df9b73d0a22235eb06ad4c48eb57360832/lib/utils.bash#L212While
vfox
just use config from current directory