WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@dimatosaurus
Copy link

No description provided.

@dimatosaurus dimatosaurus requested a review from a team as a code owner January 4, 2025 21:32
@malt3
Copy link
Collaborator

malt3 commented Jan 6, 2025

Thank you for this contribution! Just out of interest: Is there a specific new feature this unblocks for you?

@williamjenagility
Copy link

@malt3 This would be useful for any project that uses rules_js >= 2.0 which in turn sets a minimum rules_nodejs >= 6.0.0. I was able to get this PR working for my use case with a minor tweak to not use the deprecated node_toolchain rule:

diff --git a/private/common.bzl b/private/common.bzl
index a93d3c0..a4c5c47 100644
--- a/private/common.bzl
+++ b/private/common.bzl
@@ -1,5 +1,5 @@
 load("@rules_nixpkgs_core//:nixpkgs.bzl", "nixpkgs_package")
-load("@rules_nodejs//nodejs/private:toolchains_repo.bzl", "PLATFORMS")
+load("@rules_nodejs//nodejs/private:nodejs_toolchains_repo.bzl", "PLATFORMS")
 
 
 def _mk_mapping(rules_nodejs_platform_name):
@@ -41,10 +41,17 @@ pkgs.buildEnv {{
         visibility = ["//visibility:public"],
     )
 
-    load("@rules_nodejs//nodejs:toolchain.bzl", "node_toolchain")
-    node_toolchain(
+    filegroup(
+        name = "npm",
+        srcs = ["bin/npm"],
+        visibility = ["//visibility:public"],
+    )
+
+    load("@rules_nodejs//nodejs:toolchain.bzl", "nodejs_toolchain")
+    nodejs_toolchain(
         name = "nodejs_nix_impl",
-        target_tool = ":nodejs",
+        node = ":nodejs",
+        npm = ":npm",
         visibility = ["//visibility:public"],
     )

@dimatosaurus
Copy link
Author

Thank you for this contribution! Just out of interest: Is there a specific new feature this unblocks for you?

Just playing around with mono repo setups built on top of nix and bazel.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants