2021-05-05 01:48:16 +02:00
|
|
|
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
|
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
|
|
|
|
2021-05-25 02:38:14 +02:00
|
|
|
PKG_BASE_NAME = "kbn-securitysolution-list-constants"
|
2021-05-05 01:48:16 +02:00
|
|
|
|
2021-05-25 02:38:14 +02:00
|
|
|
PKG_REQUIRE_NAME = "@kbn/securitysolution-list-constants"
|
2021-05-05 01:48:16 +02:00
|
|
|
|
|
|
|
SOURCE_FILES = glob(
|
|
|
|
[
|
|
|
|
"src/**/*.ts",
|
|
|
|
],
|
|
|
|
exclude = [
|
|
|
|
"**/*.test.*",
|
|
|
|
"**/*.mock.*",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
SRCS = SOURCE_FILES
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "srcs",
|
|
|
|
srcs = SRCS,
|
|
|
|
)
|
|
|
|
|
|
|
|
NPM_MODULE_EXTRA_FILES = [
|
|
|
|
"package.json",
|
|
|
|
"README.md",
|
|
|
|
]
|
|
|
|
|
|
|
|
SRC_DEPS = [
|
|
|
|
"@npm//tslib",
|
|
|
|
]
|
|
|
|
|
|
|
|
TYPES_DEPS = [
|
|
|
|
"@npm//@types/jest",
|
|
|
|
"@npm//@types/node",
|
|
|
|
]
|
|
|
|
|
|
|
|
DEPS = SRC_DEPS + TYPES_DEPS
|
|
|
|
|
|
|
|
ts_config(
|
|
|
|
name = "tsconfig",
|
|
|
|
src = "tsconfig.json",
|
|
|
|
deps = [
|
2021-08-11 07:12:45 +02:00
|
|
|
"//:tsconfig.base.json",
|
|
|
|
"//:tsconfig.bazel.json",
|
2021-05-05 01:48:16 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_project(
|
|
|
|
name = "tsc",
|
|
|
|
srcs = SRCS,
|
|
|
|
args = ["--pretty"],
|
|
|
|
declaration = True,
|
|
|
|
declaration_map = True,
|
|
|
|
out_dir = "target",
|
|
|
|
root_dir = "src",
|
|
|
|
source_map = True,
|
|
|
|
tsconfig = ":tsconfig",
|
|
|
|
deps = DEPS,
|
|
|
|
)
|
|
|
|
|
|
|
|
js_library(
|
|
|
|
name = PKG_BASE_NAME,
|
|
|
|
package_name = PKG_REQUIRE_NAME,
|
|
|
|
srcs = NPM_MODULE_EXTRA_FILES,
|
|
|
|
visibility = ["//visibility:public"],
|
2021-05-21 01:03:54 +02:00
|
|
|
deps = DEPS + [":tsc"],
|
2021-05-05 01:48:16 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
pkg_npm(
|
|
|
|
name = "npm_module",
|
|
|
|
deps = [
|
|
|
|
":%s" % PKG_BASE_NAME,
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "build",
|
|
|
|
srcs = [
|
|
|
|
":npm_module",
|
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|