-
Notifications
You must be signed in to change notification settings - Fork 10
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
Agree on a standard format for a .node-version
file?
#13
Comments
I agree with the minimum of static versions and would cast a vote for treating iojs versions and node versions as one range. Something I'd like to throw into the ring:
I'd like to question this. npm's package.json dependencies field has demonstrated the power of version patterns and semantic versioning. Usually, what people want is not to run |
That's how rbenv works, and from what I read on the documentation this accounts the same for rvm. |
Although the reasoning behind it isn't really applicable to node, here is @mislav's take on why |
The examples from #14 (comment) would also mean fuzzy constraints in .node-version files are out of the question. In classic node fashion, I would propose a JSON-structure for {
"version": "1.2.3"
} Extensible as follows: {
"version": "1.2.3",
"engine": "..."
} On the plus side, it's extensible, it's simple and still readable. On the downside, it's a departure from how |
Another downside, parsing JSON without node available (since version managers generally need to operate without node available, like |
@marcelklehr |
So, you are talking about ease of implementation. I think not having node (or any json parsing platform) available is a superficial constraint, since the user needs to install something, why can't it be a version manager that runs on node? It can be. nvs, for example, shows that. I'm all for re-using package.json for this, but someone else said, the purpose of |
@marcelklehr yes, and a version manager implemented in node might be a great solution. but choosing a configuration format that imposes constraints like that on which implementations work is untenable - anything we choose absolutely must work for existing solutions as well as future ones, and |
So, you're arguing, in fact a posthumous standard is necessary that works already, instead of a new standard. Fair point. I was assuming a new standard would be a good choice since a) we're trying to integrate more than just the version and b) |
How are they already incompatible? |
Some version managers allow aliases, some don't, some treat io.js as a separate version range with its own tag, some don't, some provide fuzzy matching, some don't. |
That doesn't mean they're incompatible, as long as there is a union of consistent behavior. In other words, if all accept static versions with and/or without a v prefix, then that's compatibility. |
I think there's a mere intersection of consistent behavior. How would you integrate architecture and engine, then, without losing this compatibility? |
Sorry, s/union/intersection, is what I meant :-) I don't know how, that's an important question. Perhaps on a second line, since it's likely that tools currently only grab the first line of the file? It really depends what the parsing rules are for all the current engines. They may ignore everything after the third version number grouping; they may ignore everything after the first line - or they may hard-break if any unrecognized input exists. We'll have to research it. |
Bump. Where is this at? nvm-sh/nvm#1625 is a-waiting. :) |
Just wanted to throw this in here, ps-nvm supports both .nvmrc and reads package.json's |
I think that all node version managers should agree on this without having any feedback from the Node core team. Nothing against the core team but I don't think they'll make this a priority and we might be waiting a long time before things move on. Plus a bunch of node version managers already support it: avn, nodenv, fnm (I probably forget some). So, I would propose that What do you think? Should we put an RFC somewhere and gather all Node manager authors around it? @ljharb Are you up for this? Thanks! |
@ngryman the "core team" is those in the Version Management group, which just happens to be many of the maintainers of "all node version managers". It is us that have been unable to make a decision; we're not waiting on "node core" for anything whatsoever. This very issue is where such an RFC should be posted, if someone comes up with one. The above comments pose problems that nobody has yet suggested a solution for; any RFC should address them before being posted. |
It looks like I have been the only one opposed to "prematurely" fixating on a de facto standard :) I can see that not using a well-defined markup format for this standard makes sense for maintaining compatibility to the status quo. Thus, in the interest of extensibility I would definitely welcome some loophole that allows extending the data in the file. E.g. stressing that this standard only concerns itself with the first line of |
The concern about limiting ourselves to one line is that then we can't do other things like specify npm version, or node-gyp version, etc. |
The idea is to limit the standard to one line, for now, as this seems to be the common denominator. If some version manager wants to specify the npm version, they might do so on a second line, as you pointed out yourself, while others would ignore that line if they don't recognize its meaning. So, we'd have partial compatibility :'D On the other hand, it's probably smarter to standardize as much as possible, with the option to ignore it. So, we could have the full node version in the first line as mandatory, and afterwards a |
I like that general approach - something like "first line is nothing but the node version, further lines must either be blank/only whitespace (ignored), begin with "#" (a comment, also ignored), or be in the format |
@ljharb Thanks for the precisions and sorry for my misunderstanding here. My goal was more to give a new impulsion to that topic more than blaming anyone, which I wouldn't dare to! Please allow me to give my point of view on this one. I think that
For the other "20% checks" (which are basically 80% of the time So to sum up:
|
That's also a reasonable approach. Even in the "one-line" part, we'd have to figure out a union of semantics:
etc. |
Might be good to follow the |
In the interested of clarity, while I do think future implementations should support Windows line endings, I have not investigated current implementations and would do that before deciding on how to word that aspect. |
I am dropping my effort to get consensus here on a minimal backwards compatible standard format. I suspect I joined this conversation years too late to gain interest from the original contributors, besides pushing a very conservative and unexciting format! Ah well. |
@ljharb At some point an executive decision needs to be made here. If you think this is dead then please close this ticket so we can stop spending years on it. I think if It's also unclear to me why every previous version of the file needs to work. Publish |
FWIW, nodenv will continue supporting
We will be happy to make slight modifications to increase commonality, but we won't drastically change a file format that we've been using for years simply to match a late arrival. I would be in favor of at least documenting the behavior of current tooling so that a minimal set of conformance could be decided. Implementors would then be free to implement as desired; but at least with the knowledge of where compatibility is possible. |
@jasonkarns very bluntly: the end users and downstream tooling will decide that. |
@MatthewHerbst i'm not aware of any plans for npm to support yarn.lock files, and i've been following the repos and in the RFC calls for many months. I think that, if nodenv did not already use this file, then certainly it would be reasonable for the most popular projects - all of which are represented in this working group - to agree on something and thus defacto define it as the ecosystem standard. I don't think it would be reasonable, ethical, or kind for a majority to steamroll a single project, regardless of which project it is or that project's usage. If there's a common format we can use that's compatible with nodenv, and its extensibility is specified and is also compatible with individual version managers, then that is a viable path forward.
Breaking users causes harm and costs a lot of time and money. Doing it out of necessity is one thing, but doing it capriciously - ie, when any nonbreaking option remains available - is a hostile act. nvm's v1.0 will be to indicate it's fully stable, not to justify radical breakage. |
@ljharb Based on the most recent npm blog post, it seems
I agree, I don't want to "steamroll" anyone either. However, at some point a decision needs to be made, and based on every comment above, no one/no project is going to be perfectly happy with the outcome. There is no lack of community input on this thread.
We've been at this for four years. Based on the requirements laid out in many, many comments above, and what you and others who have executive power here are and are not amenable to, it seems increasingly clear that there is not such an option.
I was just picking an easy/random sem-ver breaking number. I'm well aware that, as the package isn't at 1.0.0 yet any minor change is a breaking change. |
Thanks, I missed the blog post.
You say that as if it's a given, but I don't think it is. Often, "no decision" is the best course of action rather than "the wrong decision". |
I fully support "no decision" if that's what you think is best. If that's the case, let's close this and move on. |
I'm honestly surprised that there hasn't been any progress on this issue for the past 4 years. Wouldn't it be a start to have an MVP kinda If even that isn't acceptable, then I think it's better to just close this issue, and forget about a universal standard. I'm happy with how nodenv works nonetheless. |
I had started investigating this early in the year. Dug out my notes and tidied up into a repo, and been filling out the compatibility matrix: https://github.com/shadowspawn/node-version-usage |
@shadowspawn That research is fantastic, thank you for that! Would there be interest in hosting a file in this repo proposing at least this format (https://github.com/shadowspawn/node-version-usage#suggested-compatible-format)? That could function as a reference for tooling to aim at or link to. |
Per the compatibility matrix there's only one manager that doesn’t support a leading v, and there’s a PR open to fix that direnv/direnv#1071 (I tested the logic there). In that light, it might make sense to require the leading Then, the common format becomes minimally:
Also, it doesn't support .node-version (yet?) but the maintainer of this plugin describes why it requires a leading v: eirslett/frontend-maven-plugin#1075 (comment) |
In perfect life |
The PR was merged, so all support leading v. |
To clarify, the Docker Hub node images are tagged without a leading https://hub.docker.com/_/node/tags?page=&page_size=&ordering=&name=20 |
It seems like, at a minimum, this would need to support
v4.5.6
and6.7.8
- ie, static versions, both with and without thev
.It would certainly not support aliases, since a) that varies widely by version management tool, and b) the point of an "x-version" file is to target one specific version.
This raises the question, however, about io.js versions, which it should also support. Should
iojs-v1.2.3
be allowed? If not,v1.2.3
would still unambiguously point to an io.js version. What about a future where there's more than the version number to target - like, "engine" or "architecture"?The text was updated successfully, but these errors were encountered: