From 20e2d1489566cf0a90d6b082edf0d5ef4736d559 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Mon, 2 Mar 2020 08:07:00 -0800 Subject: [PATCH 1/3] feat(rollup): add silent attr to rollup_bundle to support --silent flag As rollup_bundle already supports specific rollup flags with specific attributes on the rollup_bundle rule, adding a boolean attribute for silent makes the most sense. This boolean determines if the --silent flag is added to the rollup command when called. --- packages/rollup/src/rollup_bundle.bzl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/rollup/src/rollup_bundle.bzl b/packages/rollup/src/rollup_bundle.bzl index 98722a1854..7b8ccbd624 100644 --- a/packages/rollup/src/rollup_bundle.bzl +++ b/packages/rollup/src/rollup_bundle.bzl @@ -168,6 +168,9 @@ Otherwise, the outputs are assumed to be a single file. cfg = "host", default = "@npm//rollup/bin:rollup", ), + "silent": attr.bool( + doc = "Whether to execute the rollup binary with the --silent flag", + ), "sourcemap": attr.string( doc = """Whether to produce sourcemaps. @@ -303,6 +306,10 @@ def _rollup_bundle(ctx): args.add_all(["--format", ctx.attr.format]) + if ctx.attr.silent: + # Run the rollup binary with the --silent flag + args.add("--silent") + stamp = ctx.attr.node_context_data[NodeContextInfo].stamp config = ctx.actions.declare_file("_%s.rollup_config.js" % ctx.label.name) From 983563ca6330eabf01e3205f425ce5a1c055aa71 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Mon, 2 Mar 2020 09:39:29 -0800 Subject: [PATCH 2/3] fixup! fix(examples): change build target label to //src:prodapp --- packages/rollup/src/rollup_bundle.bzl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/rollup/src/rollup_bundle.bzl b/packages/rollup/src/rollup_bundle.bzl index 7b8ccbd624..ebf88c028f 100644 --- a/packages/rollup/src/rollup_bundle.bzl +++ b/packages/rollup/src/rollup_bundle.bzl @@ -169,7 +169,12 @@ Otherwise, the outputs are assumed to be a single file. default = "@npm//rollup/bin:rollup", ), "silent": attr.bool( - doc = "Whether to execute the rollup binary with the --silent flag", + doc = """Whether to execute the rollup binary with the --silent flag, defaults to False. + +Using --silent can cause rollup to [ignore errors/warnings](https://github.com/rollup/rollup/blob/master/docs/999-big-list-of-options.md#onwarn) +which are only surfaced via logging. Since bazel expects printing nother on success, setting silent to True +is a more Bazel-idiomatic experience, however could cause rollup to drop important warnings. +""", ), "sourcemap": attr.string( doc = """Whether to produce sourcemaps. From 869f16cae8f87f0d92ba3abcccdf5c76d1ec62a3 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Mon, 2 Mar 2020 10:24:01 -0800 Subject: [PATCH 3/3] fixup! fix(examples): change build target label to //src:prodapp --- packages/rollup/src/rollup_bundle.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rollup/src/rollup_bundle.bzl b/packages/rollup/src/rollup_bundle.bzl index ebf88c028f..67d966c276 100644 --- a/packages/rollup/src/rollup_bundle.bzl +++ b/packages/rollup/src/rollup_bundle.bzl @@ -172,7 +172,7 @@ Otherwise, the outputs are assumed to be a single file. doc = """Whether to execute the rollup binary with the --silent flag, defaults to False. Using --silent can cause rollup to [ignore errors/warnings](https://github.com/rollup/rollup/blob/master/docs/999-big-list-of-options.md#onwarn) -which are only surfaced via logging. Since bazel expects printing nother on success, setting silent to True +which are only surfaced via logging. Since bazel expects printing nothing on success, setting silent to True is a more Bazel-idiomatic experience, however could cause rollup to drop important warnings. """, ),