daml/bazel_tools/rules_nodejs_npm_cli_path.patch

31 lines
1.8 KiB
Diff
Raw Normal View History

diff --git a/internal/node/node_repositories.bzl b/internal/node/node_repositories.bzl
index 087c9ada..6eef8186 100644
--- a/internal/node/node_repositories.bzl
+++ b/internal/node/node_repositories.bzl
@@ -355,9 +355,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 [
@@ -381,7 +389,6 @@ def _prepare_node(repository_ctx):
# Use the npm-cli.js script as the bin for oxs & 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 oxs & 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)