bazel-contrib / rules_nodejs

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

[FR]: Provide codegen for `node_repositories` value to simplify NodeJS upgrades #3782

Open Silic0nS0ldier opened 2 months ago

Silic0nS0ldier commented 2 months ago

What is the current behavior?

When using a version of NodeJS not known to the ruleset (typically a newer version) node_repositories must be specified. This is not difficult, but it is tedious (many hashes and strings to wrangle).

e.g.

NODE_VERSIONS = {
    "20.14.0-darwin_arm64": ("node-v20.14.0-darwin-arm64.tar.gz", "node-v20.14.0-darwin-arm64", "d2148d79e9ff04d2982d00faeae942ceba488ca327a91065e528235167b9e9d6"),
    "20.14.0-darwin_amd64": ("node-v20.14.0-darwin-x64.tar.gz", "node-v20.14.0-darwin-x64", "1dcc18a199cb5f46d43ed1c3c61b87a247d1a1a11dd6b32a36a9c46ac1088f86"),
    "20.14.0-linux_arm64": ("node-v20.14.0-linux-arm64.tar.xz", "node-v20.14.0-linux-arm64", "8fb7012589850390ec658f58aaa11656031f64a7a8efb0b37607ca140cefe3a9"),
    "20.14.0-linux_ppc64le": ("node-v20.14.0-linux-ppc64le.tar.xz", "node-v20.14.0-linux-ppc64le", "2476aa037046e707c1fd755be624f0144438c3ce02fa0a4d0bb8b29fae84b5af"),
    "20.14.0-linux_s390x": ("node-v20.14.0-linux-s390x.tar.xz", "node-v20.14.0-linux-s390x", "fafd8e3ac753f7e1468c9390f9f40dd9227172b9cac0ae3902e6df91861519da"),
    "20.14.0-linux_amd64": ("node-v20.14.0-linux-x64.tar.xz", "node-v20.14.0-linux-x64", "fedf8fa73b6f51c4ffcc5da8f86cd1ed381bc9dceae0829832c7d683a78b8e36"),
    "20.14.0-windows_amd64": ("node-v20.14.0-win-x64.zip", "node-v20.14.0-win-x64", "04cc745e572ff53a6b9ce5b573e4a18303e32351e60c278a93b84466b60d532f"),
}

Describe the feature

Manually constructing node_repositories input is tedious work that can be automated easily. In fact, Rules NodeJS itself has already automated the update process internally. The request is to featurise this existing internal capability.