rules_node icon indicating copy to clipboard operation
rules_node copied to clipboard

node_binary does not write out script_args

Open rohanag12 opened this issue 8 years ago • 0 comments

The Problem

script_args attribute of the node_binary rule is not written to the generated script.

Setup

WORKSPACE:

RULES_NODE_COMMIT = 'dc9f8ba73f007a5eb3e57668e77082188c1ce219'
RULES_NODE_SHA256 = 'b0c627d7c412f8addff63b887ccc1b171033a215a47eb3186a8bca5889e7de78'

http_archive(
    name = "org_pubref_rules_node",
    url = "https://github.com/pubref/rules_node/archive/%s.zip" % RULES_NODE_COMMIT,
    strip_prefix = "rules_node-%s" % RULES_NODE_COMMIT,
    sha256 = RULES_NODE_SHA256
)

load("@org_pubref_rules_node//node:rules.bzl", "node_repositories", "yarn_modules")
node_repositories()

yarn_modules(
  name = "server_deps",
  deps = {
    "yargs": "9.0.1",
  }
)

BUILD:

load("@org_pubref_rules_node//node:rules.bzl", "node_binary", "node_module")

node_module(
  name = "server-module",
  description = "Video conferencing signaling server",
  srcs = [
    "index.js"
  ],
  deps = [
    "@server_deps//:_all_"
  ],
  main = "index.js"
)

node_binary(
  name = "server",
  entrypoint = ":server-module",
  script_args = [
    "--say hello"
  ]
)

index.js

const yargs = require('yargs');
console.log(yargs.demandOption('say', '--say Required!').parse().say);

Generated Script (bazel-bin/server) - script_args missing:

#!/usr/bin/env bash
set -e
ROOT=$(dirname $0)
export PATH="$ROOT:$PATH"
cd $ROOT/server_bundle && exec node node_modules/server-module $@

Consequentially, bazel run //:server fails.

rohanag12 avatar Nov 02 '17 05:11 rohanag12