kibana/packages/content-management/table_list/BUILD.bazel

164 lines
4 KiB
Text

load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
PKG_DIRNAME = "table_list"
PKG_REQUIRE_NAME = "@kbn/content-management-table-list"
SOURCE_FILES = glob(
[
"**/*.ts",
"**/*.tsx",
],
exclude = [
"**/*.config.js",
"**/*.mock.*",
"**/*.test.*",
"**/*.stories.*",
"**/__snapshots__",
"**/integration_tests",
"**/mocks",
"**/scripts",
"**/storybook",
"**/test_fixtures",
"**/test_helpers",
],
)
SRCS = SOURCE_FILES
filegroup(
name = "srcs",
srcs = SRCS,
)
NPM_MODULE_EXTRA_FILES = [
"package.json",
]
# In this array place runtime dependencies, including other packages and NPM packages
# which must be available for this code to run.
#
# To reference other packages use:
# "//repo/relative/path/to/package"
# eg. "//packages/kbn-utils"
#
# To reference a NPM package use:
# "@npm//name-of-package"
# eg. "@npm//lodash"
RUNTIME_DEPS = [
"//packages/kbn-i18n-react",
"//packages/kbn-i18n",
"//packages/content-management/content_editor",
"//packages/core/http/core-http-browser",
"//packages/core/theme/core-theme-browser",
"//packages/kbn-safer-lodash-set",
"//packages/shared-ux/page/kibana_template/impl",
"@npm//@elastic/eui",
"@npm//@emotion/react",
"@npm//@emotion/css",
"@npm//lodash",
"@npm//moment",
"@npm//react-use",
"@npm//react",
"@npm//rxjs",
]
# In this array place dependencies necessary to build the types, which will include the
# :npm_module_types target of other packages and packages from NPM, including @types/*
# packages.
#
# To reference the types for another package use:
# "//repo/relative/path/to/package:npm_module_types"
# eg. "//packages/kbn-utils:npm_module_types"
#
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"//packages/kbn-i18n:npm_module_types",
"//packages/kbn-i18n-react:npm_module_types",
"//packages/content-management/content_editor:npm_module_types",
"//packages/core/http/core-http-browser:npm_module_types",
"//packages/core/theme/core-theme-browser:npm_module_types",
"//packages/core/mount-utils/core-mount-utils-browser:npm_module_types",
"//packages/core/overlays/core-overlays-browser:npm_module_types",
"//packages/kbn-ambient-storybook-types",
"//packages/kbn-ambient-ui-types",
"//packages/kbn-safer-lodash-set:npm_module_types",
"//packages/shared-ux/page/kibana_template/impl:npm_module_types",
"//packages/shared-ux/page/kibana_template/types",
"@npm//@types/node",
"@npm//@types/jest",
"@npm//@types/lodash",
"@npm//@types/react",
"@npm//@emotion/css",
"@npm//@emotion/react",
"@npm//@elastic/eui",
"@npm//react-use",
"@npm//rxjs",
]
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
jsts_transpiler(
name = "target_web",
srcs = SRCS,
build_pkg_name = package_name(),
web = True
)
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,
emit_declaration_only = True,
out_dir = "target_types",
tsconfig = ":tsconfig",
)
js_library(
name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
js_library(
name = "npm_module_types",
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 = [":" + PKG_DIRNAME],
)
filegroup(
name = "build",
srcs = [":npm_module"],
visibility = ["//visibility:public"],
)
pkg_npm(
name = "build_types",
deps = [":npm_module_types"],
visibility = ["//visibility:public"],
)