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

node_binary does not write out script_args #49

Open
rohanag12 opened this issue Nov 2, 2017 · 0 comments
Open

node_binary does not write out script_args #49

rohanag12 opened this issue Nov 2, 2017 · 0 comments

Comments

@rohanag12
Copy link

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.

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

No branches or pull requests

1 participant