From 0ed61981b7c24a8dc533e2572341057d7c146f48 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Wed, 22 Dec 2021 16:09:29 +0000 Subject: [PATCH] chore(NA): splits types from code on @kbn/telemetry-tools (#121829) --- package.json | 1 + packages/BUILD.bazel | 1 + packages/kbn-telemetry-tools/BUILD.bazel | 26 +++++++++++++++++++---- packages/kbn-telemetry-tools/package.json | 1 - yarn.lock | 4 ++++ 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index efddb946320d4..4fb34109bec69 100644 --- a/package.json +++ b/package.json @@ -601,6 +601,7 @@ "@types/kbn__server-http-tools": "link:bazel-bin/packages/kbn-server-http-tools/npm_module_types", "@types/kbn__server-route-repository": "link:bazel-bin/packages/kbn-server-route-repository/npm_module_types", "@types/kbn__std": "link:bazel-bin/packages/kbn-std/npm_module_types", + "@types/kbn__telemetry-tools": "link:bazel-bin/packages/kbn-telemetry-tools/npm_module_types", "@types/license-checker": "15.0.0", "@types/listr": "^0.14.0", "@types/loader-utils": "^1.1.3", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 724d9810910bd..7415e41d62e91 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -118,6 +118,7 @@ filegroup( "//packages/kbn-server-http-tools:build_types", "//packages/kbn-server-route-repository:build_types", "//packages/kbn-std:build_types", + "//packages/kbn-telemetry-tools:build_types", ], ) diff --git a/packages/kbn-telemetry-tools/BUILD.bazel b/packages/kbn-telemetry-tools/BUILD.bazel index d2ea3a704f154..aed7ea3b61d27 100644 --- a/packages/kbn-telemetry-tools/BUILD.bazel +++ b/packages/kbn-telemetry-tools/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-telemetry-tools" PKG_REQUIRE_NAME = "@kbn/telemetry-tools" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__telemetry-tools" 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", ":tsc_types"], + deps = RUNTIME_DEPS + [":target_node"], 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-telemetry-tools/package.json b/packages/kbn-telemetry-tools/package.json index cb281524abefe..61960422402ce 100644 --- a/packages/kbn-telemetry-tools/package.json +++ b/packages/kbn-telemetry-tools/package.json @@ -3,7 +3,6 @@ "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "main": "./target_node/index.js", - "types": "./target_types/index.d.ts", "private": true, "kibana": { "devOnly": true diff --git a/yarn.lock b/yarn.lock index 443096829ba9e..55a18910fb13c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6001,6 +6001,10 @@ version "0.0.0" uid "" +"@types/kbn__telemetry-tools@link:bazel-bin/packages/kbn-telemetry-tools/npm_module_types": + version "0.0.0" + uid "" + "@types/keyv@*": version "3.1.1" resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.1.tgz#e45a45324fca9dab716ab1230ee249c9fb52cfa7"