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

Support slash-based aliases for LTS #193

Closed
2 tasks
dcalhoun opened this issue Jan 21, 2021 · 6 comments
Closed
2 tasks

Support slash-based aliases for LTS #193

dcalhoun opened this issue Jan 21, 2021 · 6 comments

Comments

@dcalhoun
Copy link

dcalhoun commented Jan 21, 2021

Support for aliases was added in #176, which is great! However, the support appears to use a dash-based naming convention, which diverges from nvm's slash-based naming convention.

If possible, it'd be helpful to align to (or at least support) the slash-based naming convention. Doing so would allow...

@augustobmoura
Copy link
Member

The main problem is how the core asdf handles names, it can't use / because it needs to be a valid directory name (lts/erbium actually creates a lts dir with a erbium dir inside). I talked about it in #176 (comment), sorry if was not clear in the original comment is a bit hard to describe the problem. I made the suggestion asdf-vm/asdf#352 (comment) in asdf core that should allow nvm style aliases. We can tinker about other ways though

@dcalhoun
Copy link
Author

@augustobmoura ah, thank you for providing that context. I overlooked that helpful information. It does seem like supporting aliases containing slashes is a bit more involved and potentially related to asdf core.

@blimmer
Copy link
Contributor

blimmer commented Jan 21, 2021

I wonder if when reading the legacy/.nvmrc file, we could do the conversion there? Then, asdf and asdf-nodejs could treat the value as lts-erbium for its purposes. Basically just a little adapter for their syntax.

Thoughts?

@augustobmoura
Copy link
Member

augustobmoura commented Jan 21, 2021

Actually... There is a way of supporting .nvmrc files using the parse-legacy-file hook, I didn't see that hook before. asdf install nodejs lts/erbium will still not work though

@augustobmoura
Copy link
Member

I opened the #194 PR to add this translation at legacy file level, tested in my machine and it worked fine. Maybe we can leave the issue open for the asdf install nodejs lts/erbium issue. Running asdf install nodejs(without the version) in the directory with the .nvmrc file installs the correct version for the project

@augustobmoura
Copy link
Member

We changed the way aliases work on #348, now you need to explicitly opt-in with dynamic ranges on legacy version files (.tool-versions and .nvmrc). The .tool-versions file doesn't support non-deterministic versions, and supporting it on .tool-versions is not a feature we are seeking to implement at the moment.

To enable it, you need to provide an ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY environment variable choosing between the latest_available and latest_installed strategies, you can read more about it in the appropriate section on the README of the project. To make this choice permanent you can export said variable from your shell rc file like so:

export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY=latest_installed
# OR
export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY=latest_available

Please update the plugin by running asdf plugin-update nodejs. If a new issue arises with the new implementation please open a new issue.

blimmer added a commit to blimmer/dotfiles that referenced this issue May 29, 2023
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

No branches or pull requests

3 participants