build: add an npm_package rule for @angular/bazel (#22628)

PR Close #22628
This commit is contained in:
Alex Eagle 2018-03-07 09:04:27 -08:00
parent 4f744cc66f
commit fcb8c492d6
5 changed files with 47 additions and 4 deletions

View File

@ -2,9 +2,9 @@ workspace(name = "angular")
http_archive(
name = "build_bazel_rules_nodejs",
url = "https://github.com/bazelbuild/rules_nodejs/archive/0.5.0.zip",
strip_prefix = "rules_nodejs-0.5.0",
sha256 = "06aabb253c3867d51724386ac5622a0a238bbd82e2c70ce1d09ee3ceac4c31d6",
url = "https://github.com/bazelbuild/rules_nodejs/archive/0.5.1.zip",
strip_prefix = "rules_nodejs-0.5.1",
sha256 = "dabd1a596a6f00939875762dcb1de93b5ada0515069244198aa6792bc37bb92a",
)
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")

View File

@ -1 +1,23 @@
# Empty marker file, indicating this directory is a Bazel package.
load("@build_bazel_rules_nodejs//:defs.bzl", "npm_package")
genrule(
name = "workspace",
outs = ["WORKSPACE"],
cmd = "echo 'workspace(name=\"angular\")' > $@",
)
npm_package(
name = "npm_package",
srcs = [
"package.json",
"index.bzl",
"//packages/bazel/src:package_assets",
],
deps = [":workspace"],
# Re-host //packages/bazel/ which is just // in the public distro
replacements = {
"//packages/bazel/": "//",
"angular/packages/bazel/": "angular/",
},
stamp_data = "//tools:stamp_data",
)

View File

@ -1,5 +1,14 @@
package(default_visibility = ["//visibility:public"])
filegroup(
name = "package_assets",
srcs = glob(["*"]) + [
"//packages/bazel/src/ng_package:package_assets",
"//packages/bazel/src/ngc-wrapped:package_assets",
],
visibility = ["//packages/bazel:__subpackages__"],
)
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
nodejs_binary(

View File

@ -1,5 +1,11 @@
package(default_visibility = ["//visibility:public"])
filegroup(
name = "package_assets",
srcs = glob(["*"]),
visibility = ["//packages/bazel:__subpackages__"],
)
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")

View File

@ -1,6 +1,12 @@
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
filegroup(
name = "package_assets",
srcs = glob(["*"]),
visibility = ["//packages/bazel:__subpackages__"],
)
ts_library(
name = "ngc_lib",
srcs = [