b9acd3ce74
* chore(NA): moving @kbn/dev-utils to babel transpiler * chore(NA): fix types field on tsconfig files for packages missing it * chore(NA): update package.jsons * chore(NA): update kbn/pm dist * chore(NA): update types field on package jsons Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
142 lines
2.5 KiB
Python
142 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("//src/dev/bazel:index.bzl", "jsts_transpiler")
|
|
|
|
PKG_BASE_NAME = "kbn-dev-utils"
|
|
PKG_REQUIRE_NAME = "@kbn/dev-utils"
|
|
|
|
SOURCE_FILES = glob(
|
|
[
|
|
"src/**/*.ts",
|
|
],
|
|
exclude = [
|
|
"**/*.test.*"
|
|
],
|
|
)
|
|
|
|
SRCS = SOURCE_FILES
|
|
|
|
filegroup(
|
|
name = "srcs",
|
|
srcs = SRCS,
|
|
)
|
|
|
|
filegroup(
|
|
name = "certs",
|
|
srcs = glob(
|
|
[
|
|
"certs/**/*",
|
|
],
|
|
exclude = [
|
|
"**/README.md"
|
|
],
|
|
),
|
|
)
|
|
|
|
NPM_MODULE_EXTRA_FILES = [
|
|
"package.json",
|
|
"README.md",
|
|
":certs",
|
|
"ci_stats_reporter/package.json",
|
|
"stdio/package.json",
|
|
"tooling_log/package.json"
|
|
]
|
|
|
|
RUNTIME_DEPS = [
|
|
"//packages/kbn-std",
|
|
"//packages/kbn-utils",
|
|
"@npm//@babel/core",
|
|
"@npm//axios",
|
|
"@npm//chalk",
|
|
"@npm//cheerio",
|
|
"@npm//dedent",
|
|
"@npm//execa",
|
|
"@npm//exit-hook",
|
|
"@npm//getopts",
|
|
"@npm//globby",
|
|
"@npm//load-json-file",
|
|
"@npm//markdown-it",
|
|
"@npm//moment",
|
|
"@npm//normalize-path",
|
|
"@npm//rxjs",
|
|
"@npm//tar",
|
|
"@npm//tree-kill",
|
|
"@npm//vinyl",
|
|
"@npm//yauzl"
|
|
]
|
|
|
|
TYPES_DEPS = [
|
|
"//packages/kbn-std",
|
|
"//packages/kbn-utils",
|
|
"@npm//axios",
|
|
"@npm//execa",
|
|
"@npm//exit-hook",
|
|
"@npm//getopts",
|
|
"@npm//rxjs",
|
|
"@npm//tree-kill",
|
|
"@npm//@types/babel__core",
|
|
"@npm//@types/cheerio",
|
|
"@npm//@types/dedent",
|
|
"@npm//@types/flot",
|
|
"@npm//@types/jest",
|
|
"@npm//@types/markdown-it",
|
|
"@npm//@types/node",
|
|
"@npm//@types/normalize-path",
|
|
"@npm//@types/react",
|
|
"@npm//@types/tar",
|
|
"@npm//@types/testing-library__jest-dom",
|
|
"@npm//@types/vinyl",
|
|
"@npm//@types/yauzl"
|
|
]
|
|
|
|
jsts_transpiler(
|
|
name = "target_node",
|
|
srcs = SRCS,
|
|
build_pkg_name = package_name(),
|
|
)
|
|
|
|
ts_config(
|
|
name = "tsconfig",
|
|
src = "tsconfig.json",
|
|
deps = [
|
|
"//:tsconfig.base.json",
|
|
],
|
|
)
|
|
|
|
ts_project(
|
|
name = "tsc_types",
|
|
args = ['--pretty'],
|
|
srcs = SRCS,
|
|
deps = TYPES_DEPS,
|
|
declaration = True,
|
|
declaration_map = True,
|
|
emit_declaration_only = True,
|
|
incremental = False,
|
|
out_dir = "target_types",
|
|
source_map = True,
|
|
root_dir = "src",
|
|
tsconfig = ":tsconfig",
|
|
)
|
|
|
|
js_library(
|
|
name = PKG_BASE_NAME,
|
|
srcs = NPM_MODULE_EXTRA_FILES,
|
|
deps = RUNTIME_DEPS + [":target_node", ":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"],
|
|
)
|