bazel-contrib / rules_nodejs

NodeJS toolchain for Bazel.
https://bazelbuild.github.io/rules_nodejs/
Apache License 2.0
733 stars 523 forks source link

[FR]: Expose known Node versions (as starlark variable) #3765

Closed gzm0 closed 4 months ago

gzm0 commented 4 months ago

What is the current behavior?

The list of versions that is supported is private.

https://github.com/bazelbuild/rules_nodejs/blob/6f9c4ad26b4558712a8d921c76a3038311b1594f/nodejs/private/node_versions.bzl#L6

Also, it is somewhat unstructured, as can be seen by how DEFAULT_NODE_VERSION is calculated:

https://github.com/bazelbuild/rules_nodejs/blob/6f9c4ad26b4558712a8d921c76a3038311b1594f/nodejs/repositories.bzl#L19-L24

Describe the feature

We are struggling to integrate Renovate and rules_nodejs properly: Since rules_nodejs always lags a bit behind in node versions, we get a lot of very noisy updates (that fail, because rules_nodejs doesn't recognize the version yet).

Our plan is to automatically update the Renovate configuration (via bazel write_source_files rules) to include appropriate configuration (we do a similar thing with the pnpm version for rules_js).

However, since the supported Node versions are not exported, we cannot do this.

I'd like to propose the following (happy to do the implementation work, just wanted to check in first):