From 56d6e1112cc72eca4366cd216ea6bd98e7862c8a Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Mon, 20 Dec 2021 17:23:35 +0000 Subject: [PATCH] chore(NA): splits types from code on @kbn/securitysolution-io-ts-types --- package.json | 1 + packages/BUILD.bazel | 1 + .../BUILD.bazel | 2 +- .../BUILD.bazel | 2 +- .../BUILD.bazel | 26 ++++++++++++++++--- .../package.json | 1 - yarn.lock | 6 ++++- 7 files changed, 31 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 6dd026150cb11..5a9ad8864e1c2 100644 --- a/package.json +++ b/package.json @@ -580,6 +580,7 @@ "@types/kbn__optimizer": "link:bazel-bin/packages/kbn-optimizer/npm_module_types", "@types/kbn__plugin-generator": "link:bazel-bin/packages/kbn-plugin-generator/npm_module_types", "@types/kbn__plugin-helpers": "link:bazel-bin/packages/kbn-plugin-helpers/npm_module_types", + "@types/kbn__securitysolution-io-ts-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-types/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 64936ba71fcf2..bb39bad42a88b 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -98,6 +98,7 @@ filegroup( "//packages/kbn-optimizer:build_types", "//packages/kbn-plugin-generator:build_types", "//packages/kbn-plugin-helpers:build_types", + "//packages/kbn-securitysolution-io-ts-types", ], ) diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/BUILD.bazel b/packages/kbn-securitysolution-io-ts-alerting-types/BUILD.bazel index cdee3a2f92540..9c5f654f174f3 100644 --- a/packages/kbn-securitysolution-io-ts-alerting-types/BUILD.bazel +++ b/packages/kbn-securitysolution-io-ts-alerting-types/BUILD.bazel @@ -36,7 +36,7 @@ RUNTIME_DEPS = [ ] TYPES_DEPS = [ - "//packages/kbn-securitysolution-io-ts-types", + "//packages/kbn-securitysolution-io-ts-types:npm_module_types", "//packages/kbn-securitysolution-io-ts-utils", "@npm//fp-ts", "@npm//io-ts", diff --git a/packages/kbn-securitysolution-io-ts-list-types/BUILD.bazel b/packages/kbn-securitysolution-io-ts-list-types/BUILD.bazel index ff4f2e80cbd37..c28ef55457eaa 100644 --- a/packages/kbn-securitysolution-io-ts-list-types/BUILD.bazel +++ b/packages/kbn-securitysolution-io-ts-list-types/BUILD.bazel @@ -35,7 +35,7 @@ RUNTIME_DEPS = [ ] TYPES_DEPS = [ - "//packages/kbn-securitysolution-io-ts-types", + "//packages/kbn-securitysolution-io-ts-types:npm_module_types", "//packages/kbn-securitysolution-io-ts-utils", "@npm//fp-ts", "@npm//io-ts", diff --git a/packages/kbn-securitysolution-io-ts-types/BUILD.bazel b/packages/kbn-securitysolution-io-ts-types/BUILD.bazel index fe2247ac0b614..68b63cca141f7 100644 --- a/packages/kbn-securitysolution-io-ts-types/BUILD.bazel +++ b/packages/kbn-securitysolution-io-ts-types/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-securitysolution-io-ts-types" PKG_REQUIRE_NAME = "@kbn/securitysolution-io-ts-types" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__securitysolution-io-ts-types" 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", ":target_web", ":tsc_types"], + deps = RUNTIME_DEPS + [":target_node", ":target_web"], 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-securitysolution-io-ts-types/package.json b/packages/kbn-securitysolution-io-ts-types/package.json index 767c8d0f0cbcb..76e405c227053 100644 --- a/packages/kbn-securitysolution-io-ts-types/package.json +++ b/packages/kbn-securitysolution-io-ts-types/package.json @@ -5,6 +5,5 @@ "license": "SSPL-1.0 OR Elastic License 2.0", "browser": "target_web/index.js", "main": "./target_node/index.js", - "types": "./target_types/index.d.ts", "private": true } diff --git a/yarn.lock b/yarn.lock index 3d2f64513ad9f..f7b110adf37dd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5884,6 +5884,10 @@ version "0.0.0" uid "" +"@types/kbn__securitysolution-io-ts-types@link:bazel-bin/packages/kbn-securitysolution-io-ts-types/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" @@ -10461,7 +10465,7 @@ core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.9: resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== -core-js@^3.19.3, core-js@^3.0.4, core-js@^3.6.5, core-js@^3.8.2, core-js@^3.8.3: +core-js@^3.0.4, core-js@^3.19.3, core-js@^3.6.5, core-js@^3.8.2, core-js@^3.8.3: version "3.19.3" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.19.3.tgz#6df8142a996337503019ff3235a7022d7cdf4559" integrity sha512-LeLBMgEGSsG7giquSzvgBrTS7V5UL6ks3eQlUSbN8dJStlLFiRzUm5iqsRyzUB8carhfKjkJ2vzKqE6z1Vga9g==