blob: 326fa91155ff5a996ac5ecf9081ae2b7acfdd431 [file]
load("@npm//@bazel/labs:index.bzl", "ts_proto_library")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load("@npm//@bazel/terser:index.bzl", "terser_minified")
load("@npm//@bazel/typescript:index.bzl", "ts_project")
load("@rules_proto//proto:defs.bzl", "proto_library")
load(":jest.bzl", "jest_test")
proto_library(
name = "tire_proto",
srcs = ["tire.proto"],
)
ts_proto_library(
# The result will be "tire.d.ts" named after this target.
# We could use the output_name attribute if we want the output named
# differently than the target.
name = "tire",
proto = ":tire_proto",
)
proto_library(
name = "car_proto",
srcs = ["car.proto"],
deps = [":tire_proto"],
)
ts_proto_library(
# The result will be "car.d.ts" named after this target.
# We could use the output_name attribute if we want the output named
# differently than the target.
name = "car",
proto = ":car_proto",
)
ts_project(
name = "test_lib",
testonly = True,
srcs = ["car.spec.ts"],
deps = [
":car",
":tire",
"@npm//@types/google-protobuf",
"@npm//@types/jest",
"@npm//@types/node",
"@npm//grpc-web",
],
)
jest_test(
name = "test",
srcs = [
"babel.config.js",
":car.spec.js",
],
jest_config = ":jest.config.js",
deps = [
":car",
":tire",
"@npm//@babel/core",
"@npm//@babel/preset-env",
"@npm//babel-jest",
"@npm//google-protobuf",
],
)
ts_project(
name = "app",
srcs = ["app.ts"],
deps = [
":car",
"@npm//@types/google-protobuf",
"@npm//grpc-web",
],
)
# Test for production mode
rollup_bundle(
name = "bundle",
srcs = [
":tsconfig.json",
],
config_file = "rollup.config.js",
entry_point = ":app.ts",
format = "iife",
deps = [
":app",
"@npm//@rollup/plugin-typescript",
],
)
terser_minified(
name = "bundle.min",
src = ":bundle",
)
proto_library(
name = "rules_typescript_proto",
srcs = [
"car.proto",
"tire.proto",
],
visibility = ["//visibility:public"],
)
# Just a dummy test so that we have a test target for //... on certain bazelci platforms with bazel_integration_test
sh_test(
name = "dummy_test",
srcs = ["dummy_test.sh"],
)