126 lines
2.1 KiB
Python
126 lines
2.1 KiB
Python
|
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
||
|
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
||
|
|
||
|
PKG_BASE_NAME = "kbn-securitysolution-t-grid"
|
||
|
|
||
|
PKG_REQUIRE_NAME = "@kbn/securitysolution-t-grid"
|
||
|
|
||
|
SOURCE_FILES = glob(
|
||
|
[
|
||
|
"src/**/*.ts",
|
||
|
"src/**/*.tsx",
|
||
|
],
|
||
|
exclude = [
|
||
|
"**/*.test.*",
|
||
|
"**/*.mock.*",
|
||
|
],
|
||
|
)
|
||
|
|
||
|
SRCS = SOURCE_FILES
|
||
|
|
||
|
filegroup(
|
||
|
name = "srcs",
|
||
|
srcs = SRCS,
|
||
|
)
|
||
|
|
||
|
NPM_MODULE_EXTRA_FILES = [
|
||
|
"react/package.json",
|
||
|
"package.json",
|
||
|
"README.md",
|
||
|
]
|
||
|
|
||
|
SRC_DEPS = [
|
||
|
"//packages/kbn-babel-preset",
|
||
|
"//packages/kbn-dev-utils",
|
||
|
"//packages/kbn-i18n",
|
||
|
"@npm//@babel/core",
|
||
|
"@npm//babel-loader",
|
||
|
"@npm//enzyme",
|
||
|
"@npm//jest",
|
||
|
"@npm//lodash",
|
||
|
"@npm//react",
|
||
|
"@npm//react-beautiful-dnd",
|
||
|
"@npm//tslib",
|
||
|
]
|
||
|
|
||
|
TYPES_DEPS = [
|
||
|
"@npm//typescript",
|
||
|
"@npm//@types/enzyme",
|
||
|
"@npm//@types/jest",
|
||
|
"@npm//@types/lodash",
|
||
|
"@npm//@types/node",
|
||
|
"@npm//@types/react",
|
||
|
"@npm//@types/react-beautiful-dnd",
|
||
|
]
|
||
|
|
||
|
DEPS = SRC_DEPS + TYPES_DEPS
|
||
|
|
||
|
ts_config(
|
||
|
name = "tsconfig",
|
||
|
src = "tsconfig.json",
|
||
|
deps = [
|
||
|
"//:tsconfig.base.json",
|
||
|
],
|
||
|
)
|
||
|
|
||
|
ts_config(
|
||
|
name = "tsconfig_browser",
|
||
|
src = "tsconfig.browser.json",
|
||
|
deps = [
|
||
|
"//:tsconfig.base.json",
|
||
|
"//:tsconfig.browser.json",
|
||
|
],
|
||
|
)
|
||
|
|
||
|
ts_project(
|
||
|
name = "tsc",
|
||
|
args = ["--pretty"],
|
||
|
srcs = SRCS,
|
||
|
deps = DEPS,
|
||
|
declaration = True,
|
||
|
declaration_dir = "target_types",
|
||
|
declaration_map = True,
|
||
|
incremental = True,
|
||
|
out_dir = "target_node",
|
||
|
root_dir = "src",
|
||
|
source_map = True,
|
||
|
tsconfig = ":tsconfig",
|
||
|
)
|
||
|
|
||
|
ts_project(
|
||
|
name = "tsc_browser",
|
||
|
args = ['--pretty'],
|
||
|
srcs = SRCS,
|
||
|
deps = DEPS,
|
||
|
allow_js = True,
|
||
|
declaration = False,
|
||
|
incremental = True,
|
||
|
out_dir = "target_web",
|
||
|
source_map = True,
|
||
|
root_dir = "src",
|
||
|
tsconfig = ":tsconfig_browser",
|
||
|
)
|
||
|
|
||
|
js_library(
|
||
|
name = PKG_BASE_NAME,
|
||
|
package_name = PKG_REQUIRE_NAME,
|
||
|
srcs = NPM_MODULE_EXTRA_FILES,
|
||
|
visibility = ["//visibility:public"],
|
||
|
deps = [":tsc", ":tsc_browser"] + DEPS,
|
||
|
)
|
||
|
|
||
|
pkg_npm(
|
||
|
name = "npm_module",
|
||
|
deps = [
|
||
|
":%s" % PKG_BASE_NAME,
|
||
|
],
|
||
|
)
|
||
|
|
||
|
filegroup(
|
||
|
name = "build",
|
||
|
srcs = [
|
||
|
":npm_module",
|
||
|
],
|
||
|
visibility = ["//visibility:public"],
|
||
|
)
|