kibana/packages/kbn-analytics/BUILD.bazel
Thomas Watson 8042faf448
Remove dependencies for empty @types/* packages (#144324) (#144686)
The removed packages were empty becuase the packages for which they provide
types now ship with their own types. So they are no longer needed.

The following command was run to find them:

    find node_modules/@types \
      -mindepth 1 \
      -maxdepth 1 \
      -type d '!' \
      -exec test -e "{}/index.d.ts" ';' \
      -print

In this case that produced the following output:

    node_modules/@types/moment-timezone
    node_modules/@types/strip-ansi
    node_modules/@types/joi
    node_modules/@types/rrule
    node_modules/@types/vfile-message
    node_modules/@types/reduce-reducers
    node_modules/@types/react-resize-detector
    node_modules/@types/pretty-ms

Except for `vfile-message` all of these were direct dependencies and could be
removed.

(cherry picked from commit b02d976a3b)

# Conflicts:
#	packages/core/logging/core-logging-common-internal/BUILD.bazel
#	packages/kbn-failed-test-reporter-cli/BUILD.bazel
#	yarn.lock

Co-authored-by: Spencer <spencer@elastic.co>
2022-11-07 05:55:56 -07:00

132 lines
2.3 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_BASE_NAME = "kbn-analytics"
PKG_REQUIRE_NAME = "@kbn/analytics"
SOURCE_FILES = glob(
[
"**/*.ts",
],
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"
]
RUNTIME_DEPS = [
"@npm//moment",
"@npm//moment-timezone",
"@npm//tslib",
]
TYPES_DEPS = [
"@npm//moment",
"@npm//moment-timezone",
"@npm//@types/node",
]
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_config(
name = "tsconfig_browser",
src = "tsconfig.browser.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.browser.json",
"//:tsconfig.browser_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",
tsconfig = ":tsconfig",
)
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
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"],
)
pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)
filegroup(
name = "build_types",
srcs = [
":npm_module_types",
],
visibility = ["//visibility:public"],
)