kibana/packages/kbn-securitysolution-list-hooks/BUILD.bazel
Tiago Costa fc236ad494
chore(NA): moving @kbn/securitysolution-list-hooks to babel transpiler (#110490)
* chore(NA): moving @kbn/securitysolution-list-hooks to babel transpiler

* chore(NA): remove comments

* chore(NA): introduce web bundles
2021-08-31 02:20:18 +01:00

113 lines
2.3 KiB
Python

load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
PKG_BASE_NAME = "kbn-securitysolution-list-hooks"
PKG_REQUIRE_NAME = "@kbn/securitysolution-list-hooks"
SOURCE_FILES = glob(
[
"src/**/*.ts",
],
exclude = [
"**/*.test.*",
"**/*.mock.*",
],
)
SRCS = SOURCE_FILES
filegroup(
name = "srcs",
srcs = SRCS,
)
NPM_MODULE_EXTRA_FILES = [
"package.json",
"README.md",
]
RUNTIME_DEPS = [
"//packages/kbn-securitysolution-hook-utils",
"//packages/kbn-securitysolution-io-ts-list-types",
"//packages/kbn-securitysolution-list-api",
"//packages/kbn-securitysolution-list-constants",
"//packages/kbn-securitysolution-list-utils",
"//packages/kbn-securitysolution-utils",
"@npm//@testing-library/react-hooks",
"@npm//react",
]
TYPES_DEPS = [
"//packages/kbn-securitysolution-hook-utils",
"//packages/kbn-securitysolution-io-ts-list-types",
"//packages/kbn-securitysolution-list-api",
"//packages/kbn-securitysolution-list-constants",
"//packages/kbn-securitysolution-list-utils",
"//packages/kbn-securitysolution-utils",
"@npm//@types/jest",
"@npm//@types/node",
"@npm//@types/react",
"@npm//@types/testing-library__react-hooks",
]
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
jsts_transpiler(
name = "target_web",
srcs = SRCS,
build_pkg_name = package_name(),
config_file = ".babelrc.browser"
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.bazel.json",
],
)
ts_project(
name = "tsc_types",
args = ["--pretty"],
srcs = SRCS,
deps = TYPES_DEPS,
declaration = True,
declaration_map = True,
emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src",
source_map = True,
tsconfig = ":tsconfig",
)
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
pkg_npm(
name = "npm_module",
deps = [
":%s" % PKG_BASE_NAME,
],
)
filegroup(
name = "build",
srcs = [
":npm_module",
],
visibility = ["//visibility:public"],
)