* [build_ts_refs] improve caches, allow building a subset of projects * cleanup project def script and update refs in type check script * rename browser_bazel config to avoid kebab-case * remove execInProjects() helper * list references for tsconfig.types.json for api-extractor workload * disable composite features of tsconfig.types.json for api-extractor * set declaration: true to avoid weird debug error * fix jest tests Co-authored-by: spalger <spalger@users.noreply.github.com> # Conflicts: # .gitignore # examples/hello_world/tsconfig.json # tsconfig.json # tsconfig.refs.json Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
125 lines
2.4 KiB
Python
125 lines
2.4 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-cli-dev-mode"
|
|
PKG_REQUIRE_NAME = "@kbn/cli-dev-mode"
|
|
|
|
SOURCE_FILES = glob(
|
|
[
|
|
"src/**/*.ts",
|
|
],
|
|
exclude = ["**/*.test.*"],
|
|
)
|
|
|
|
SRCS = SOURCE_FILES
|
|
|
|
filegroup(
|
|
name = "srcs",
|
|
srcs = SRCS,
|
|
)
|
|
|
|
NPM_MODULE_EXTRA_FILES = [
|
|
"package.json",
|
|
"README.md"
|
|
]
|
|
|
|
RUNTIME_DEPS = [
|
|
"//packages/kbn-config",
|
|
"//packages/kbn-config-schema",
|
|
"//packages/kbn-dev-utils",
|
|
"//packages/kbn-logging",
|
|
"//packages/kbn-optimizer",
|
|
"//packages/kbn-server-http-tools",
|
|
"//packages/kbn-std",
|
|
"//packages/kbn-utils",
|
|
"@npm//@hapi/h2o2",
|
|
"@npm//@hapi/hapi",
|
|
"@npm//argsplit",
|
|
"@npm//chokidar",
|
|
"@npm//elastic-apm-node",
|
|
"@npm//execa",
|
|
"@npm//getopts",
|
|
"@npm//lodash",
|
|
"@npm//moment",
|
|
"@npm//rxjs",
|
|
"@npm//supertest",
|
|
]
|
|
|
|
TYPES_DEPS = [
|
|
"//packages/kbn-config",
|
|
"//packages/kbn-config-schema",
|
|
"//packages/kbn-dev-utils",
|
|
"//packages/kbn-logging",
|
|
"//packages/kbn-optimizer",
|
|
"//packages/kbn-server-http-tools",
|
|
"//packages/kbn-std",
|
|
"//packages/kbn-utils",
|
|
"@npm//argsplit",
|
|
"@npm//chokidar",
|
|
"@npm//elastic-apm-node",
|
|
"@npm//execa",
|
|
"@npm//moment",
|
|
"@npm//rxjs",
|
|
"@npm//supertest",
|
|
"@npm//@types/hapi__h2o2",
|
|
"@npm//@types/hapi__hapi",
|
|
"@npm//@types/getopts",
|
|
"@npm//@types/jest",
|
|
"@npm//@types/lodash",
|
|
"@npm//@types/node",
|
|
"@npm//@types/supertest",
|
|
]
|
|
|
|
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,
|
|
declaration = True,
|
|
declaration_map = True,
|
|
emit_declaration_only = True,
|
|
out_dir = "target_types",
|
|
root_dir = "src",
|
|
source_map = True,
|
|
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"],
|
|
)
|