Skip to content

Commit

Permalink
chore(NA): splits types from code on @kbn/std
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic committed Dec 21, 2021
1 parent aacebdb commit 0f0980a
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 11 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,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__std": "link:bazel-bin/packages/kbn-std/npm_module_types",
"@types/license-checker": "15.0.0",
"@types/listr": "^0.14.0",
"@types/loader-utils": "^1.1.3",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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-std:build_types",
],
)

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-cli-dev-mode/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ TYPES_DEPS = [
"//packages/kbn-logging",
"//packages/kbn-optimizer:npm_module_types",
"//packages/kbn-server-http-tools",
"//packages/kbn-std",
"//packages/kbn-std:npm_module_types",
"//packages/kbn-utils",
"@npm//argsplit",
"@npm//chokidar",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TYPES_DEPS = [
"//packages/elastic-safer-lodash-set",
"//packages/kbn-config-schema:npm_module_types",
"//packages/kbn-logging",
"//packages/kbn-std",
"//packages/kbn-std:npm_module_types",
"//packages/kbn-utility-types",
"//packages/kbn-i18n:npm_module_types",
"@npm//load-json-file",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-logging/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUNTIME_DEPS = [
]

TYPES_DEPS = [
"//packages/kbn-std",
"//packages/kbn-std:npm_module_types",
"@npm//@types/jest",
"@npm//@types/node",
]
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ TYPES_DEPS = [
"//packages/kbn-config:npm_module_types",
"//packages/kbn-config-schema:npm_module_types",
"//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-std",
"//packages/kbn-std:npm_module_types",
"//packages/kbn-ui-shared-deps-npm",
"//packages/kbn-ui-shared-deps-src",
"//packages/kbn-utils",
Expand Down
26 changes: 22 additions & 4 deletions packages/kbn-std/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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-std"
PKG_REQUIRE_NAME = "@kbn/std"
TYPES_PKG_REQUIRE_NAME = "@types/kbn__std"

SOURCE_FILES = glob(
[
Expand Down Expand Up @@ -77,7 +78,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"],
)
Expand All @@ -96,3 +97,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"],
)
1 change: 0 additions & 1 deletion packages/kbn-std/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@kbn/std",
"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
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ RUNTIME_DEPS = [
TYPES_DEPS = [
"//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-i18n-react:npm_module_types",
"//packages/kbn-std",
"//packages/kbn-std:npm_module_types",
"//packages/kbn-utils",
"@npm//@elastic/elasticsearch",
"@npm//axios",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps-src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TYPES_DEPS = [
"//packages/kbn-i18n:npm_module_types",
"//packages/kbn-i18n-react:npm_module_types",
"//packages/kbn-monaco:npm_module_types",
"//packages/kbn-std",
"//packages/kbn-std:npm_module_types",
"//packages/kbn-ui-shared-deps-npm",
"@npm//@elastic/eui",
"@npm//webpack",
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5981,6 +5981,10 @@
version "0.0.0"
uid ""

"@types/kbn__std@link:bazel-bin/packages/kbn-std/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"
Expand Down

0 comments on commit 0f0980a

Please sign in to comment.