2019-04-19 02:37:01 -04:00
|
|
|
# BEGIN-INTERNAL
|
2019-05-09 17:51:51 -04:00
|
|
|
load("@build_bazel_rules_nodejs//:defs.bzl", "npm_package")
|
|
|
|
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
|
2019-02-20 12:54:42 -05:00
|
|
|
load("@npm_bazel_typescript//:index.bzl", "ts_library")
|
2018-03-01 13:41:35 -05:00
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "lib",
|
|
|
|
srcs = glob(["lib/*.ts"]),
|
|
|
|
module_name = "ts-api-guardian",
|
|
|
|
tsconfig = "//tools:tsconfig.json",
|
|
|
|
visibility = ["//visibility:public"],
|
2018-10-18 12:58:38 -04:00
|
|
|
deps = [
|
2019-04-09 21:08:13 -04:00
|
|
|
"@npm//@types/diff",
|
|
|
|
"@npm//@types/minimist",
|
|
|
|
"@npm//@types/node",
|
2019-04-23 08:47:18 -04:00
|
|
|
"@npm//chalk",
|
2019-04-09 21:08:13 -04:00
|
|
|
"@npm//diff",
|
|
|
|
"@npm//minimist",
|
|
|
|
"@npm//typescript",
|
2018-10-18 12:58:38 -04:00
|
|
|
],
|
2018-03-01 13:41:35 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
# Copy Angular's license to govern ts-api-guardian as well.
|
|
|
|
# We use a genrule to put it in this package, so it will be in the right root directory.
|
|
|
|
genrule(
|
|
|
|
name = "license",
|
|
|
|
srcs = ["//:LICENSE"],
|
|
|
|
outs = ["LICENSE"],
|
|
|
|
cmd = "cp $< $@",
|
|
|
|
)
|
|
|
|
|
|
|
|
npm_package(
|
|
|
|
name = "ts-api-guardian",
|
|
|
|
srcs = [
|
2019-04-19 02:37:01 -04:00
|
|
|
"BUILD.bazel",
|
2018-03-01 13:41:35 -05:00
|
|
|
"README.md",
|
|
|
|
"bin/ts-api-guardian",
|
2019-04-19 02:37:01 -04:00
|
|
|
"index.bzl",
|
2018-03-01 13:41:35 -05:00
|
|
|
"package.json",
|
|
|
|
],
|
2019-04-19 02:37:01 -04:00
|
|
|
replacements = {
|
2019-04-23 08:47:18 -04:00
|
|
|
"@angular//tools/ts-api-guardian:bin": "@npm_ts_api_guardian//:bin",
|
|
|
|
"@angular//tools/ts-api-guardian:lib": "@npm//ts-api-guardian",
|
2019-04-19 02:37:01 -04:00
|
|
|
"angular/tools/ts-api-guardian/": "npm_ts_api_guardian/",
|
|
|
|
},
|
2018-03-01 13:41:35 -05:00
|
|
|
deps = [
|
|
|
|
":lib",
|
|
|
|
":license",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
#######################################3
|
|
|
|
# Tests for this package
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "test_lib",
|
|
|
|
testonly = True,
|
|
|
|
srcs = glob(["test/*.ts"]),
|
2018-10-04 16:14:14 -04:00
|
|
|
tsconfig = "//tools:tsconfig-test",
|
|
|
|
deps = [
|
|
|
|
":lib",
|
2019-04-09 21:08:13 -04:00
|
|
|
"@npm//@types/chai",
|
|
|
|
"@npm//@types/jasmine",
|
|
|
|
"@npm//@types/node",
|
|
|
|
"@npm//chai",
|
|
|
|
"@npm//jasmine",
|
|
|
|
"@npm//typescript",
|
2018-10-04 16:14:14 -04:00
|
|
|
],
|
2018-03-01 13:41:35 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
jasmine_node_test(
|
|
|
|
name = "tests",
|
|
|
|
srcs = [":test_lib"],
|
|
|
|
bootstrap = ["angular/tools/ts-api-guardian/test/bootstrap.js"],
|
|
|
|
data = glob([
|
|
|
|
"test/fixtures/*.ts",
|
|
|
|
"test/fixtures/*.patch",
|
|
|
|
]) + [
|
|
|
|
":ts-api-guardian",
|
2018-10-29 16:25:00 -04:00
|
|
|
# TODO: remove this once the boostrap.js workaround has been removed.
|
|
|
|
":package.json",
|
2018-03-01 13:41:35 -05:00
|
|
|
],
|
|
|
|
)
|
2019-04-19 02:37:01 -04:00
|
|
|
# END-INTERNAL
|
|
|
|
|
2019-04-23 13:12:00 -04:00
|
|
|
filegroup(
|
|
|
|
name = "bin",
|
|
|
|
srcs = glob(["lib/*.js"]) + ["bin/ts-api-guardian"],
|
2019-04-19 02:37:01 -04:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
2019-06-07 16:38:06 -04:00
|
|
|
|
|
|
|
# Exported to be referenced as entry_point of the nodejs_binary
|
|
|
|
exports_files(["bin/ts-api-guardian"])
|