Skip to content

Commit

Permalink
Don't generate empty scripts = [] in generated build files
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed Apr 9, 2019
1 parent dcc9778 commit 5b74f06
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 26 deletions.
14 changes: 9 additions & 5 deletions internal/npm_install/generate_build_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,16 @@ function printPackage(pkg) {
// TODO(gmagolan): add UMD & AMD scripts to scripts even if not an APF package _but_ only if they
// are named?
const scripts = getNgApfScripts(pkg);

const pkgDeps = pkg._dependencies.filter(dep => dep !== pkg && !dep._isNested);

let scriptStarlark = '';
if (scripts.length) {
scriptStarlark = `
scripts = [
${scripts.map(f => `":${f}",`).join('\n ')}
],`;
}

let result = `load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
load("@build_bazel_rules_nodejs//internal/npm_install:node_module_library.bzl", "node_module_library")
Expand All @@ -725,10 +732,7 @@ node_module_library(
name = "${pkg._name}__files",
srcs = [
${sources.map(f => `":${f}",`).join('\n ')}
],
scripts = [
${scripts.map(f => `":${f}",`).join('\n ')}
],
],${scriptStarlark}
)
node_module_library(
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5b74f06

Please sign in to comment.