From f7a0afc5e1827e90d2ecf31210551e8e8b14f2e0 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Wed, 22 Dec 2021 02:37:29 +0000 Subject: [PATCH] chore(NA): splits types from code on @kbn/server-http-tools (#121807) --- package.json | 1 + packages/BUILD.bazel | 1 + packages/kbn-cli-dev-mode/BUILD.bazel | 2 +- packages/kbn-server-http-tools/BUILD.bazel | 26 +++++++++++++++++---- packages/kbn-server-http-tools/package.json | 1 - yarn.lock | 4 ++++ 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 7586c6db42574..ced32bd622bb2 100644 --- a/package.json +++ b/package.json @@ -598,6 +598,7 @@ "@types/kbn__securitysolution-rules": "link:bazel-bin/packages/kbn-securitysolution-rules/npm_module_types", "@types/kbn__securitysolution-t-grid": "link:bazel-bin/packages/kbn-securitysolution-t-grid/npm_module_types", "@types/kbn__securitysolution-utils": "link:bazel-bin/packages/kbn-securitysolution-utils/npm_module_types", + "@types/kbn__server-http-tools": "link:bazel-bin/packages/kbn-server-http-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 018ea0dcddceb..009f94c415c29 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -115,6 +115,7 @@ filegroup( "//packages/kbn-securitysolution-rules:build_types", "//packages/kbn-securitysolution-t-grid:build_types", "//packages/kbn-securitysolution-utils:build_types", + "//packages/kbn-server-http-tools:build_types", ], ) diff --git a/packages/kbn-cli-dev-mode/BUILD.bazel b/packages/kbn-cli-dev-mode/BUILD.bazel index 22a8137a782a6..0a50dcf272723 100644 --- a/packages/kbn-cli-dev-mode/BUILD.bazel +++ b/packages/kbn-cli-dev-mode/BUILD.bazel @@ -53,7 +53,7 @@ TYPES_DEPS = [ "//packages/kbn-dev-utils:npm_module_types", "//packages/kbn-logging", "//packages/kbn-optimizer:npm_module_types", - "//packages/kbn-server-http-tools", + "//packages/kbn-server-http-tools:npm_module_types", "//packages/kbn-std", "//packages/kbn-utils", "@npm//argsplit", diff --git a/packages/kbn-server-http-tools/BUILD.bazel b/packages/kbn-server-http-tools/BUILD.bazel index be74c363a7acf..e524078a8ba89 100644 --- a/packages/kbn-server-http-tools/BUILD.bazel +++ b/packages/kbn-server-http-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-server-http-tools" PKG_REQUIRE_NAME = "@kbn/server-http-tools" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__server-http-tools" SOURCE_FILES = glob( [ @@ -82,7 +83,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"], ) @@ -101,3 +102,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-server-http-tools/package.json b/packages/kbn-server-http-tools/package.json index 9255dfe5c8d21..1d35f093c66e6 100644 --- a/packages/kbn-server-http-tools/package.json +++ b/packages/kbn-server-http-tools/package.json @@ -1,7 +1,6 @@ { "name": "@kbn/server-http-tools", "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 f5e5c5e966915..0e15c842633c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5989,6 +5989,10 @@ version "0.0.0" uid "" +"@types/kbn__server-http-tools@link:bazel-bin/packages/kbn-server-http-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"