diff --git a/package.json b/package.json index b368918a0b8d1..709b2a3b6425a 100644 --- a/package.json +++ b/package.json @@ -552,6 +552,7 @@ "@types/json5": "^0.0.30", "@types/kbn__ace": "link:bazel-bin/packages/kbn-ace/npm_module_types", "@types/kbn__alerts": "link:bazel-bin/packages/kbn-alerts/npm_module_types", + "@types/kbn__analytics": "link:bazel-bin/packages/kbn-analytics/npm_module_types", "@types/kbn__i18n": "link:bazel-bin/packages/kbn-i18n/npm_module_types", "@types/kbn__i18n-react": "link:bazel-bin/packages/kbn-i18n-react/npm_module_types", "@types/license-checker": "15.0.0", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index b34571a936e6e..422ac415645dc 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -78,6 +78,7 @@ filegroup( "//packages/elastic-datemath:build_types", "//packages/kbn-ace:build_types", "//packages/kbn-alerts:build_types", + "//packages/kbn-analytics:build_types", "//packages/kbn-i18n:build_types", "//packages/kbn-i18n-react:build_types", ], diff --git a/packages/kbn-analytics/BUILD.bazel b/packages/kbn-analytics/BUILD.bazel index cc65746e890ce..94e65b2e35ba3 100644 --- a/packages/kbn-analytics/BUILD.bazel +++ b/packages/kbn-analytics/BUILD.bazel @@ -1,9 +1,10 @@ -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") +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" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__analytics" SOURCE_FILES = glob( [ @@ -81,7 +82,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"], + deps = RUNTIME_DEPS + [":target_node", ":target_web"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) @@ -100,3 +101,20 @@ filegroup( ], visibility = ["//visibility:public"], ) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = TYPES_PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [ + ":npm_module_types", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-analytics/package.json b/packages/kbn-analytics/package.json index 177c0eb815760..c3b30dcf79431 100644 --- a/packages/kbn-analytics/package.json +++ b/packages/kbn-analytics/package.json @@ -4,7 +4,6 @@ "version": "1.0.0", "description": "Kibana Analytics tool", "main": "target_node/index.js", - "types": "target_types/index.d.ts", "browser": "target_web/index.js", "author": "Ahmad Bamieh ", "license": "SSPL-1.0 OR Elastic License 2.0" diff --git a/packages/kbn-ui-shared-deps-src/BUILD.bazel b/packages/kbn-ui-shared-deps-src/BUILD.bazel index b135ae4021400..3da5e0ed9a6ff 100644 --- a/packages/kbn-ui-shared-deps-src/BUILD.bazel +++ b/packages/kbn-ui-shared-deps-src/BUILD.bazel @@ -44,7 +44,7 @@ RUNTIME_DEPS = [ TYPES_DEPS = [ "//packages/elastic-datemath:npm_module_types", "//packages/elastic-safer-lodash-set", - "//packages/kbn-analytics", + "//packages/kbn-analytics:npm_module_types", "//packages/kbn-babel-preset", "//packages/kbn-i18n:npm_module_types", "//packages/kbn-i18n-react:npm_module_types", diff --git a/yarn.lock b/yarn.lock index de750b2529b92..717b4a77a4a44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5770,6 +5770,10 @@ version "0.0.0" uid "" +"@types/kbn__analytics@link:bazel-bin/packages/kbn-analytics/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__i18n-react@link:bazel-bin/packages/kbn-i18n-react/npm_module_types": version "0.0.0" uid ""