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

[FR]: Support .nvmrc file in BZLMOD #3721

Closed
BillyBlaze opened this issue Mar 8, 2024 · 4 comments
Closed

[FR]: Support .nvmrc file in BZLMOD #3721

BillyBlaze opened this issue Mar 8, 2024 · 4 comments

Comments

@BillyBlaze
Copy link

BillyBlaze commented Mar 8, 2024

What is the current behavior?

I am currently migrating from the WORKSPACE file to BZLMOD. In the previous version we could register the toolchain to look for the .nvmrc file, such as:

nodejs_register_toolchains(
    name = "nodejs",
    use_nvmrc = "//:.nvmrc",
)

however in BZLMOD we can only provide the version hardcoded:

node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node.toolchain(node_version = "20.8.0")

can we get the new toolchain to also include the .nvmrc file?

Describe the feature

Currently we have a single source of truth that manages the node version in our mono-repo. Without this feature the danger is that people will work locally with a different version than rules_nodejs are using. Reading the version from this file will make sure that CI and locally are more closely intertwined.

Copy link

github-actions bot commented May 8, 2024

This issue has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs in 30 days. Note as of rules_nodejs v6 the rules_nodejs repository contains only the core nodejs toolchain and @bazel/runfiles package. All rulesets are removed and unmaintained. For alternate rulesets suggestions include https://github.com/aspect-build/rules_js, https://github.com/aspect-build/rules_ts Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

@github-actions github-actions bot added the Can Close? We will close this in 30 days if there is no further activity label May 8, 2024
@BillyBlaze
Copy link
Author

please dont close 😄

@setoelkahfi
Copy link

@BillyBlaze This seems to be working fine for me:

bazel_dep(name = "rules_nodejs", version = "6.1.1")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node.toolchain(node_version_from_nvmrc = "//:.nvmrc")

See.

@github-actions github-actions bot removed the Can Close? We will close this in 30 days if there is no further activity label May 30, 2024
@BillyBlaze
Copy link
Author

BillyBlaze commented Jun 3, 2024

@setoelkahfi thank you for the feedback! I didn't notice that this was introduced after I posted this issue. It would've been great that that they closed this issue with a fixed status, but I am more than happy that it landed!

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

2 participants