daml/bazel_tools/rules_nodejs_npm_cli_path.patch
Moritz Kiefer dd09c38f4a
Upgrade rules-nodejs (#11290)
I got confused by an error and thought I might as well debug it on the
latest version instead of debugging it on 3.5.1.

changelog_begin
changelog_end
2021-10-19 14:13:55 +00:00

31 lines
1.8 KiB
Diff

diff --git a/nodejs/repositories.bzl b/nodejs/repositories.bzl
index 494217b7..3eb10a41 100644
--- a/nodejs/repositories.bzl
+++ b/nodejs/repositories.bzl
@@ -379,9 +379,17 @@ def _prepare_node(repository_ctx):
repository_ctx.attr.vendored_node.package,
repository_ctx.attr.vendored_node.name,
)
+ npm_script = "/".join([f for f in [
+ "../..",
+ repository_ctx.attr.vendored_node.workspace_root,
+ repository_ctx.attr.vendored_node.package,
+ repository_ctx.attr.vendored_node.name,
+ "lib/node_modules/npm/bin/npm-cli.js" if not is_windows else "node_modules/npm/bin/npm-cli.js",
+ ] if f])
else:
node_path = NODE_EXTRACT_DIR
node_package = NODE_EXTRACT_DIR
+ npm_script = ("%s/lib/node_modules/npm/bin/npm-cli.js" % NODE_EXTRACT_DIR) if not is_windows else ("%s/node_modules/npm/bin/npm-cli.js" % NODE_EXTRACT_DIR)
if repository_ctx.attr.vendored_yarn:
yarn_path = "/".join([f for f in [
@@ -405,7 +413,6 @@ def _prepare_node(repository_ctx):
# Use the npm-cli.js script as the bin for osx & linux so there are no symlink issues with `%s/bin/npm`
npm_bin = ("%s/lib/node_modules/npm/bin/npm-cli.js" % node_path) if not is_windows else ("%s/npm.cmd" % node_path)
npm_bin_label = ("%s/lib/node_modules/npm/bin/npm-cli.js" % node_package) if not is_windows else ("%s/npm.cmd" % node_package)
- npm_script = ("%s/lib/node_modules/npm/bin/npm-cli.js" % node_path) if not is_windows else ("%s/node_modules/npm/bin/npm-cli.js" % node_path)
# Use the npx-cli.js script as the bin for osx & linux so there are no symlink issues with `%s/bin/npx`
npx_bin = ("%s/lib/node_modules/npm/bin/npx-cli.js" % node_path) if not is_windows else ("%s/npx.cmd" % node_path)