blob: c1bb6bd013eb42533470e35dd266f009284e4b29 [file] [log] [blame]
# This BUILD file is only for publishing the
# "Gerrit Frontend Plugin TypeScript API" as an npm package.
#
# Publishing procedure:
# - Execute the `publish.sh` script from the Gerrit root dir.
# - Verify that the contents look good.
# - Increment the version in package.json.
# - Execute `publish.sh --upload`.
#
# NB: Renaming to 'BUILD' breaks the app/BUILD, because then the api/ sources
# are not visible anymore to the parent BUILD. And if ts_projects depend on each
# other, then the api/ files would have to be imported with their full package
# names.
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
filegroup(
name = "js_plugin_api_srcs",
srcs = glob(["**/*.ts"]),
)
ts_config(
name = "ts_config",
src = "tsconfig.json",
deps = [
"//plugins:tsconfig-plugins-base.json",
],
)
ts_project(
name = "js_plugin_api_compiled",
srcs = glob(["**/*.ts"]),
incremental = True,
tsc = "//tools/node_tools:tsc-bin",
tsconfig = ":ts_config",
)
# Use this rule for publishing the js plugin api as a package to the npm repo.
pkg_npm(
name = "js_plugin_api_npm_package",
package_name = "@gerritcodereview/typescript-api",
srcs = glob(
["**/*"],
exclude = [
"BUILD",
"BUILD_for_publishing_api_only",
"tsconfig.json",
"publish.sh",
],
),
deps = [
":js_plugin_api_compiled",
"//plugins:tsconfig-plugins-base.json",
],
)