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

Let user specify any version of node/npm/yarn #4

Closed
fortuna opened this issue Sep 1, 2017 · 7 comments
Closed

Let user specify any version of node/npm/yarn #4

fortuna opened this issue Sep 1, 2017 · 7 comments

Comments

@fortuna
Copy link
Contributor

fortuna commented Sep 1, 2017

rules_nodejs forces Node.js v6. However, I'd like to use v8.
It would be great to have a way to specify which version I'm using.

@alexeagle
Copy link
Collaborator

I think we ought to support LTS versions of node - that means according to the schedule we should do it next month. https://github.com/nodejs/LTS

@kamalmarhubi
Copy link

I'd strongly advocate for making the version user specified. We've had serious issues with even minor version bumps, and would need to be able to choose the node version we use.

@alexeagle
Copy link
Collaborator

Fair enough. The only hard part I see is that I need a URL to fetch node from, and it's platform dependent, plus I have manually mirrored the current version to our CDN
https://github.com/bazelbuild/rules_nodejs/blob/master/internal/node_install.bzl#L29
So I'm not sure how the user would express this dependency. Maybe it's sufficient just to give the choice of major versions (6,7,8,9).

Also I have to pick which node versions these rules are tested against. And we want rules to be portable, so if you write a node program requiring 8, then all users must upgrade. Of course that problem exists without Bazel involved.

@kamalmarhubi
Copy link

For ease of use, the current setup is great. If adding flexibility, major version is not enough for us. For example, a patch upgrade from 4.8.2 to 4.8.4 caused segfaults in production for one of our services because of issues with a native module at that version. So it's important to be able to hold back certain nodejs_binary targets.

I was reading about platforms earlier, and it seems that might be the right way to go about this. Users could define toolchains like node_6.11.3 and so on, or something like that? I haven't really understood the whole thing that well, and definitely haven't understood how toolchain resolution works.

As an intermediate that requires less fussing around with new concepts, the nodejs_binary rule could take a label to specify the nodejs executable to run. This lets users have very fine control where needed. Thoughts?

@alexeagle
Copy link
Collaborator

@kamalmarhubi I agree you need the ability to get any specific version. I'll look into platforms, but the simple answer is to change the node_repositories rule to allow you to pass a label for the the node (for each OS). You don't want it on nodejs_binary because then you could have different node version for different binaries in the same repo, which I think is a bad idea.

In addition to allowing you to specify any version, I just saw that Node 8 is now LTS so we should upgrade the default version that ships with the rules.

@alexeagle alexeagle changed the title Node 6 is too old Let user specify any version of node/npm/yarn Nov 16, 2017
@Globegitter
Copy link
Contributor

rules_go also allows to swap out the version of the go sdk, might be worth synchronising with how it is done there.

@alexeagle
Copy link
Collaborator

Fixed in #183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants