From 22b91fb388b13ed97d6aaf0e6d961b32486b9363 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 30 Nov 2021 18:14:05 +0000 Subject: [PATCH] chore(NA): splits types from code on @kbn/apm-utils (#119977) --- package.json | 1 + packages/BUILD.bazel | 1 + packages/kbn-apm-utils/BUILD.bazel | 26 ++++++++++++++++++++++---- packages/kbn-apm-utils/package.json | 1 - yarn.lock | 4 ++++ 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1c9b4a842d16..cbe8c64a6736 100644 --- a/package.json +++ b/package.json @@ -558,6 +558,7 @@ "@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__apm-utils": "link:bazel-bin/packages/kbn-apm-utils/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 dff91679a2d9..b6aa948de0fa 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -80,6 +80,7 @@ filegroup( "//packages/kbn-ace:build_types", "//packages/kbn-alerts:build_types", "//packages/kbn-analytics:build_types", + "//packages/kbn-apm-utils:build_types", "//packages/kbn-i18n:build_types", "//packages/kbn-i18n-react:build_types", ], diff --git a/packages/kbn-apm-utils/BUILD.bazel b/packages/kbn-apm-utils/BUILD.bazel index fdfd593476fe..c8ad4d1a0962 100644 --- a/packages/kbn-apm-utils/BUILD.bazel +++ b/packages/kbn-apm-utils/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-apm-utils" PKG_REQUIRE_NAME = "@kbn/apm-utils" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__apm-utils" SOURCE_FILES = glob([ "src/index.ts", @@ -61,7 +62,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"], ) @@ -80,3 +81,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-apm-utils/package.json b/packages/kbn-apm-utils/package.json index 2460bc7c14cc..c57753bc83e5 100644 --- a/packages/kbn-apm-utils/package.json +++ b/packages/kbn-apm-utils/package.json @@ -1,7 +1,6 @@ { "name": "@kbn/apm-utils", "main": "./target_node/index.js", - "types": "./target_types/index.d.ts", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true diff --git a/yarn.lock b/yarn.lock index c0f9d70e39e7..2fd7e61cbabd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5817,6 +5817,10 @@ version "0.0.0" uid "" +"@types/kbn__apm-utils@link:bazel-bin/packages/kbn-apm-utils/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 ""