build: publish ts-api-guardian rule in the npm package (#29977)
With this change downstream users will no longer need to build ts-api-guardian from source as now the bazel rule is available in the npm package. This can be used by installing ts-api-guardian as a devDependency and changing the load syntax from: ``` load("@angular//tools/ts-api-guardian:index.bzl", "ts_api_guardian_test") ``` to: ``` load("@npm_ts_api_guardian//:index.bzl", "ts_api_guardian_test") ``` **Note**: downstream users should also clean their `WORKSPACE` and remove the dependencies of angular workspace. PR Close #29977
This commit is contained in:
parent
9b93bd625f
commit
d7f7826363
|
@ -1,3 +1,4 @@
|
|||
# BEGIN-INTERNAL
|
||||
load(
|
||||
"@build_bazel_rules_nodejs//:defs.bzl",
|
||||
"jasmine_node_test",
|
||||
|
@ -5,8 +6,6 @@ load(
|
|||
)
|
||||
load("@npm_bazel_typescript//:index.bzl", "ts_library")
|
||||
|
||||
exports_files(["bin/ts-api-guardian"])
|
||||
|
||||
ts_library(
|
||||
name = "lib",
|
||||
srcs = glob(["lib/*.ts"]),
|
||||
|
@ -35,10 +34,16 @@ genrule(
|
|||
npm_package(
|
||||
name = "ts-api-guardian",
|
||||
srcs = [
|
||||
"BUILD.bazel",
|
||||
"README.md",
|
||||
"bin/ts-api-guardian",
|
||||
"index.bzl",
|
||||
"package.json",
|
||||
],
|
||||
replacements = {
|
||||
"@angular//tools/ts-api-guardian": "@npm_ts_api_guardian//",
|
||||
"angular/tools/ts-api-guardian/": "npm_ts_api_guardian/",
|
||||
},
|
||||
deps = [
|
||||
":lib",
|
||||
":license",
|
||||
|
@ -79,3 +84,10 @@ jasmine_node_test(
|
|||
],
|
||||
tags = ["local"],
|
||||
)
|
||||
# END-INTERNAL
|
||||
|
||||
filegroup(
|
||||
name = "bin",
|
||||
srcs = glob(["lib/*.js"]) + ["bin/ts-api-guardian"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
@ -33,8 +33,11 @@ def ts_api_guardian_test(
|
|||
"""Runs ts_api_guardian
|
||||
"""
|
||||
data += [
|
||||
# BEGIN-INTERNAL
|
||||
# Locally we need to add the TS build target
|
||||
"@angular//tools/ts-api-guardian:lib",
|
||||
"@angular//tools/ts-api-guardian:bin/ts-api-guardian",
|
||||
# END-INTERNAL
|
||||
"@angular//tools/ts-api-guardian:bin",
|
||||
]
|
||||
|
||||
args = [
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
"description": "Guards the API of TypeScript libraries!",
|
||||
"main": "lib/main.js",
|
||||
"typings": "lib/main.d.ts",
|
||||
"bazelWorkspaces": {
|
||||
"npm_ts_api_guardian": {
|
||||
"version": "0.4.1",
|
||||
"rootPath": "."
|
||||
}
|
||||
},
|
||||
"bin": {
|
||||
"ts-api-guardian": "./bin/ts-api-guardian"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue