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

Add support for .node-version files #8

Closed
jantimon opened this issue Jan 24, 2019 · 13 comments
Closed

Add support for .node-version files #8

jantimon opened this issue Jan 24, 2019 · 13 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jantimon
Copy link

jantimon commented Jan 24, 2019

Most version managers support the .node-version format:

Tool Name Config File Plattform Notes
nvs .node-version Mac / Linux / Windows  
nvm .nvmrc Mac / Linux
nodenv .node-version Mac / Linux  
nodist .node-version Windows  
avn .node-version Mac / Linux  
n   Mac / Linux Does not seem to have a config file option

Could you please also add support?

@ljharb
Copy link

ljharb commented Jan 24, 2019

I’d suggest not using it; it’s not actually a standard, and in fact it’s current use means that the Node Version Management Group will (when it only day creates a standard) be defining a different file name and format.

@jantimon
Copy link
Author

jantimon commented Jan 24, 2019

We already use .node-version filename for many projects because it is right now the best supported format which works on windows and mac.

Would be cool if these projects could work with fnm too.

Would it be a huge change to add support for it? I would like to understand the disadvantage of adding support for it

@ljharb
Copy link

ljharb commented Jan 24, 2019

The disadvantage is yet another version manager implying that this file is a standard, when in fact it isn’t and can never be.

@jantimon
Copy link
Author

jantimon commented Jan 24, 2019

Well people don’t need to use it - it just adds compatibility to sth what’s already commonly used

It also supports nvmrc which is also no standard so I can’t see why that would be a big deal for node-version

@ljharb
Copy link

ljharb commented Jan 24, 2019

Right - I’m saying that it’s better to be less compatible, so as to help make that format less commonly used, because it will one day be very harmful for the ecosystem to have that file as the commonly used one.

@jantimon
Copy link
Author

So if I understand you correctly we should also drop support for .nvmrc to help the future eco system?

@ljharb
Copy link

ljharb commented Jan 24, 2019

If you like, but .nvmrc has "nvm" in the name, so it's clearly not a cross-ecosystem standard, nor will it ever be.

Whatever filename we go with will be something new that is not tied to any specific version manager.

@jantimon
Copy link
Author

4 of 6 node version managers (which work for mac, windows and linux) support .node-version so for me that’s already a little bit like a standard and I can’t see the risk you try to describe.

would love to know what @Schniz thinks about this

@ljharb
Copy link

ljharb commented Jan 24, 2019

The instant the node version management working group declares a standard format, it won't be ¯\_(ツ)_/¯ (and we won't be declaring ".node-version")

@Schniz
Copy link
Owner

Schniz commented Jan 25, 2019

I’m not familiar with .node-version as I have only used nvm. How popular is it? I’m pretty sure it’s not hard to implement, but every file type (or file name) will make it slower. Maybe it’s for the best though

@jantimon
Copy link
Author

Cool :)

There are already 45.000 Github repositories using a .node-version file

The content is very simple but in the early days there were two formats:

  • v0.0.0
  • 0.0.0

Nowadays all version managers seem to skip the v in front of the version but I guess it would be nice not to bail if one exists.

nodenv has a nice description how it picks up the version and also notes how they handle .node-version

nvs just says that the .node-version file is looked up recursively in the file structure

nodist uses a similar description like nvs

avn also notes that the .node-version is using the semver format

@Schniz
Copy link
Owner

Schniz commented Jan 28, 2019

This is exactly how I implemented the .nvmrc file (I add the v prefix when there isn't one). I'd accept PRs that implement that - it's a good first issue in my opinion 😸

This can be by changing the Nvmrc module to a module with a new name that checks for every known file we support (and that'll be two files for now 😄)

If someone needs any help with implementing it, reach me out with a DM or an Email or something. I'd love to help!

The only thing worth noting is that we'll need to have some kind of priority.

@Schniz Schniz added the good first issue Good for newcomers label Jan 30, 2019
@brandom
Copy link

brandom commented Feb 13, 2019

@Schniz Just dropping in to say thanks and great work! A new tab in Hyper went from ..... to . as soon as I installed fnm and switched off nvm.

My two cents on the above discussion is that it appears the WG hasn't met in two years and the initial proposal, IMHO, doesn't make a compelling argument for creating what amounts to yet-another-version-manager with an official stamp.

Adding support for a de facto standard cross-vm config like .node-version is "the right thing" to do, just as you currently support the config file for the de facto standard version manager.

I would love to show my gratitude with a PR but I am short on time at the moment, I will check back this weekend to see if this or another GFI is open.

@Schniz Schniz added the enhancement New feature or request label Feb 14, 2019
Schniz pushed a commit that referenced this issue Feb 18, 2019
adding support for `.node-version` files, along with `.nvmrc` files

Resolves #8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants