85 lines
2.0 KiB
Python
85 lines
2.0 KiB
Python
package(default_visibility = ["//visibility:public"])
|
|
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
|
|
load("@npm//http-server:index.bzl", "http_server")
|
|
load("@npm_angular_bazel//:index.bzl", "ng_module")
|
|
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
|
|
load("@npm_bazel_terser//:index.bzl", "terser_minified")
|
|
load("@npm_bazel_typescript//:index.bzl", "ts_devserver")
|
|
|
|
# Allow targets under sub-packages to reference the tsconfig.json file
|
|
exports_files(["tsconfig.json"])
|
|
|
|
ng_module(
|
|
name = "src",
|
|
srcs = glob(["*.ts"]),
|
|
generate_ve_shims = True,
|
|
deps = [
|
|
"//src/hello-world",
|
|
"@npm//@angular/common",
|
|
"@npm//@angular/core",
|
|
"@npm//@angular/platform-browser",
|
|
"@npm//@angular/router",
|
|
"@npm//@types",
|
|
"@npm//rxjs",
|
|
],
|
|
)
|
|
|
|
filegroup(
|
|
name = "rxjs_umd_modules",
|
|
srcs = [
|
|
# do not sort
|
|
"@npm//:node_modules/rxjs/bundles/rxjs.umd.js",
|
|
":rxjs_shims.js",
|
|
],
|
|
)
|
|
|
|
ts_devserver(
|
|
name = "devserver",
|
|
additional_root_paths = ["npm/node_modules/zone.js/dist"],
|
|
entry_module = "bazel_integration_test/src/main",
|
|
scripts = [
|
|
":rxjs_umd_modules",
|
|
],
|
|
# Use the same bundle serving path as prodserver so that we can share
|
|
# an index.html file.
|
|
serving_path = "/bundle.min.js",
|
|
static_files = [
|
|
"index.html",
|
|
"@npm//:node_modules/zone.js/dist/zone.min.js",
|
|
],
|
|
deps = ["//src"],
|
|
)
|
|
|
|
rollup_bundle(
|
|
name = "bundle",
|
|
config_file = "rollup.config.js",
|
|
entry_point = ":main.ts",
|
|
deps = [
|
|
"//src",
|
|
"@npm//rollup-plugin-commonjs",
|
|
"@npm//rollup-plugin-node-resolve",
|
|
],
|
|
)
|
|
|
|
terser_minified(
|
|
name = "bundle.min",
|
|
src = ":bundle",
|
|
)
|
|
|
|
pkg_web(
|
|
name = "prodapp",
|
|
srcs = [
|
|
"index.html",
|
|
":bundle.min",
|
|
"@npm//:node_modules/zone.js/dist/zone.min.js",
|
|
],
|
|
additional_root_paths = ["npm/node_modules/zone.js/dist"],
|
|
)
|
|
|
|
http_server(
|
|
name = "prodserver",
|
|
data = [":prodapp"],
|
|
templated_args = ["src/prodapp"],
|
|
)
|