* [kbn/ui-shared-deps] split into two packages * fix asset categorizer * update snapshots * reference npm dll from optimizer Co-authored-by: spalger <spalger@users.noreply.github.com>
129 lines
2.5 KiB
Python
129 lines
2.5 KiB
Python
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
|
load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
|
|
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
|
|
|
|
PKG_BASE_NAME = "kbn-ui-shared-deps-src"
|
|
PKG_REQUIRE_NAME = "@kbn/ui-shared-deps-src"
|
|
|
|
SOURCE_FILES = glob(
|
|
[
|
|
"src/**/*",
|
|
],
|
|
exclude = [
|
|
"**/*.md",
|
|
],
|
|
)
|
|
|
|
SRCS = SOURCE_FILES
|
|
|
|
filegroup(
|
|
name = "srcs",
|
|
srcs = SRCS,
|
|
)
|
|
|
|
NPM_MODULE_EXTRA_FILES = [
|
|
"flot_charts/package.json",
|
|
"theme/package.json",
|
|
"package.json",
|
|
"README.md"
|
|
]
|
|
|
|
RUNTIME_DEPS = [
|
|
"//packages/elastic-datemath",
|
|
"//packages/elastic-safer-lodash-set",
|
|
"//packages/kbn-analytics",
|
|
"//packages/kbn-babel-preset",
|
|
"//packages/kbn-i18n",
|
|
"//packages/kbn-monaco",
|
|
"//packages/kbn-std",
|
|
"//packages/kbn-ui-shared-deps-npm",
|
|
"//packages/kbn-utils",
|
|
]
|
|
|
|
TYPES_DEPS = [
|
|
"//packages/elastic-datemath",
|
|
"//packages/elastic-safer-lodash-set",
|
|
"//packages/kbn-analytics",
|
|
"//packages/kbn-babel-preset",
|
|
"//packages/kbn-i18n",
|
|
"//packages/kbn-monaco",
|
|
"//packages/kbn-std",
|
|
"//packages/kbn-ui-shared-deps-npm",
|
|
"//packages/kbn-utils",
|
|
"@npm//@elastic/eui",
|
|
"@npm//resize-observer-polyfill",
|
|
"@npm//webpack",
|
|
]
|
|
|
|
jsts_transpiler(
|
|
name = "target_node",
|
|
srcs = SRCS,
|
|
build_pkg_name = package_name(),
|
|
)
|
|
|
|
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,
|
|
allow_js = True,
|
|
declaration = True,
|
|
declaration_map = True,
|
|
emit_declaration_only = True,
|
|
out_dir = "target_types",
|
|
root_dir = "src",
|
|
source_map = True,
|
|
tsconfig = ":tsconfig",
|
|
)
|
|
|
|
webpack(
|
|
name = "shared_built_assets",
|
|
data = RUNTIME_DEPS + [
|
|
"//:package.json",
|
|
":srcs",
|
|
":tsconfig",
|
|
":webpack.config.js",
|
|
],
|
|
output_dir = True,
|
|
args = [
|
|
"--config",
|
|
"$(location webpack.config.js)",
|
|
"--output-path",
|
|
"$(@D)",
|
|
"--display=minimal"
|
|
],
|
|
)
|
|
|
|
js_library(
|
|
name = PKG_BASE_NAME,
|
|
srcs = NPM_MODULE_EXTRA_FILES,
|
|
deps = RUNTIME_DEPS + [":target_node", ":tsc_types", ":shared_built_assets"],
|
|
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"],
|
|
)
|