From c3dc60c3c1f75b19840f440825a7ae0a30f9c983 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 21 Dec 2021 17:25:13 +0000 Subject: [PATCH 1/2] chore(NA): splits types from code on @kbn/server-route-repository --- package.json | 1 + packages/BUILD.bazel | 1 + .../kbn-server-route-repository/BUILD.bazel | 27 ++++++++++++++++--- .../kbn-server-route-repository/package.json | 1 - yarn.lock | 4 +++ 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 18d7ce10286ec..e4785696be2dd 100644 --- a/package.json +++ b/package.json @@ -595,6 +595,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-route-repository": "link:bazel-bin/packages/kbn-server-route-repository/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 04c4bc9b9901c..bfe6e41798adb 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -113,6 +113,7 @@ filegroup( "//packages/kbn-securitysolution-rules:build_types", "//packages/kbn-securitysolution-t-grid:build_types", "//packages/kbn-securitysolution-utils:build_types", + "//packages/kbn-server-route-repository:build_types" ], ) diff --git a/packages/kbn-server-route-repository/BUILD.bazel b/packages/kbn-server-route-repository/BUILD.bazel index 6e7e10d4dd816..103f15bbf5d6a 100644 --- a/packages/kbn-server-route-repository/BUILD.bazel +++ b/packages/kbn-server-route-repository/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-route-repository" PKG_REQUIRE_NAME = "@kbn/server-route-repository" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__server-route-repository" SOURCE_FILES = glob( [ @@ -78,7 +79,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"], ) @@ -97,3 +98,21 @@ 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-route-repository/package.json b/packages/kbn-server-route-repository/package.json index 920abc2a3836f..32e59c896db00 100644 --- a/packages/kbn-server-route-repository/package.json +++ b/packages/kbn-server-route-repository/package.json @@ -1,7 +1,6 @@ { "name": "@kbn/server-route-repository", "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 3a460ff52e8d7..ae20a1eb195fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5944,6 +5944,10 @@ version "0.0.0" uid "" +"@types/kbn__server-route-repository@link:bazel-bin/packages/kbn-server-route-repository/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" From a6266a892905da1b74581340d93e9ef0ad3da6f7 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 21 Dec 2021 19:57:34 +0000 Subject: [PATCH 2/2] chore(NA): expose missing type --- packages/kbn-server-route-repository/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/kbn-server-route-repository/src/index.ts b/packages/kbn-server-route-repository/src/index.ts index 1cc7bd0fdeebe..7ba2b53159551 100644 --- a/packages/kbn-server-route-repository/src/index.ts +++ b/packages/kbn-server-route-repository/src/index.ts @@ -21,4 +21,5 @@ export type { ServerRouteRepository, ServerRoute, RouteParamsRT, + RouteState, } from './typings';