From b8e06e3b2de8c3855e0e87fec9c3ff31650865a9 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 7 Dec 2021 22:53:19 -0500 Subject: [PATCH] chore(NA): splits types from code on @kbn/es-archiver (#120657) (#120707) Co-authored-by: Tiago Costa --- package.json | 1 + packages/BUILD.bazel | 1 + packages/kbn-es-archiver/BUILD.bazel | 26 ++++++++++++++++++++++---- packages/kbn-es-archiver/package.json | 1 - yarn.lock | 4 ++++ 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9f93d7c527967..89869c470be78 100644 --- a/package.json +++ b/package.json @@ -566,6 +566,7 @@ "@types/kbn__crypto": "link:bazel-bin/packages/kbn-crypto/npm_module_types", "@types/kbn__dev-utils": "link:bazel-bin/packages/kbn-dev-utils/npm_module_types", "@types/kbn__docs-utils": "link:bazel-bin/packages/kbn-docs-utils/npm_module_types", + "@types/kbn__es-archiver": "link:bazel-bin/packages/kbn-es-archiver/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 9697dc603f0d8..21353d0c47a3e 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -87,6 +87,7 @@ filegroup( "//packages/kbn-crypto:build_types", "//packages/kbn-dev-utils:build_types", "//packages/kbn-docs-utils:build_types", + "//packages/kbn-es-archiver:build_types", "//packages/kbn-i18n:build_types", "//packages/kbn-i18n-react:build_types", ], diff --git a/packages/kbn-es-archiver/BUILD.bazel b/packages/kbn-es-archiver/BUILD.bazel index 5d0a8b69bbd16..00b08e242ace7 100644 --- a/packages/kbn-es-archiver/BUILD.bazel +++ b/packages/kbn-es-archiver/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-es-archiver" PKG_REQUIRE_NAME = "@kbn/es-archiver" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__es-archiver" SOURCE_FILES = glob( [ @@ -92,7 +93,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"], ) @@ -111,3 +112,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-es-archiver/package.json b/packages/kbn-es-archiver/package.json index 0cce08eaf0352..bff3990a0c1bc 100644 --- a/packages/kbn-es-archiver/package.json +++ b/packages/kbn-es-archiver/package.json @@ -4,7 +4,6 @@ "license": "SSPL-1.0 OR Elastic License 2.0", "private": "true", "main": "target_node/index.js", - "types": "target_types/index.d.ts", "kibana": { "devOnly": true } diff --git a/yarn.lock b/yarn.lock index 09831bdd72d49..2927898a1739d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5817,6 +5817,10 @@ version "0.0.0" uid "" +"@types/kbn__es-archiver@link:bazel-bin/packages/kbn-es-archiver/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 ""