Skip to content

Commit

Permalink
chore(NA): splits types from code on @kbn/config-schema (#120385)
Browse files Browse the repository at this point in the history
* chore(NA): splits types from code on @kbn/config-schema

* chore(NA): expose needed type

* chore(NA): fix api changes

* chore(NA): expose needed type
  • Loading branch information
mistic authored Dec 3, 2021
1 parent 6434762 commit 9d6955c
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 15 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
"@types/kbn__apm-utils": "link:bazel-bin/packages/kbn-apm-utils/npm_module_types",
"@types/kbn__cli-dev-mode": "link:bazel-bin/packages/kbn-cli-dev-mode/npm_module_types",
"@types/kbn__config": "link:bazel-bin/packages/kbn-config/npm_module_types",
"@types/kbn__config-schema": "link:bazel-bin/packages/kbn-config-schema/npm_module_types",
"@types/kbn__crypto": "link:bazel-bin/packages/kbn-crypto/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",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ filegroup(
"//packages/kbn-apm-utils:build_types",
"//packages/kbn-cli-dev-mode:build_types",
"//packages/kbn-config:build_types",
"//packages/kbn-config-schema:build_types",
"//packages/kbn-crypto:build_types",
"//packages/kbn-i18n:build_types",
"//packages/kbn-i18n-react: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 @@ -49,7 +49,7 @@ RUNTIME_DEPS = [

TYPES_DEPS = [
"//packages/kbn-config:npm_module_types",
"//packages/kbn-config-schema",
"//packages/kbn-config-schema:npm_module_types",
"//packages/kbn-dev-utils",
"//packages/kbn-logging",
"//packages/kbn-optimizer",
Expand Down
26 changes: 22 additions & 4 deletions packages/kbn-config-schema/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-config-schema"
PKG_REQUIRE_NAME = "@kbn/config-schema"
TYPES_PKG_REQUIRE_NAME = "@types/kbn__config-schema"

SOURCE_FILES = glob([
"src/**/*.ts",
Expand Down Expand Up @@ -72,7 +73,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 @@ -91,3 +92,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-config-schema/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@kbn/config-schema",
"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-config-schema/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
StreamType,
} from './types';

export type { TypeOf, Props, NullableProps };
export type { AnyType, ConditionalType, TypeOf, Props, NullableProps };
export { ObjectType, Type };
export { ByteSizeValue } from './byte_size_value';
export { SchemaTypeError, ValidationError } from './errors';
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 @@ -46,7 +46,7 @@ RUNTIME_DEPS = [

TYPES_DEPS = [
"//packages/elastic-safer-lodash-set",
"//packages/kbn-config-schema",
"//packages/kbn-config-schema:npm_module_types",
"//packages/kbn-logging",
"//packages/kbn-std",
"//packages/kbn-utility-types",
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-es-query/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ NPM_MODULE_EXTRA_FILES = [

RUNTIME_DEPS = [
"//packages/kbn-utility-types",
"//packages/kbn-config-schema",
"//packages/kbn-i18n",
"@npm//@elastic/elasticsearch",
"@npm//load-json-file",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-io-ts-utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUNTIME_DEPS = [
]

TYPES_DEPS = [
"//packages/kbn-config-schema",
"//packages/kbn-config-schema:npm_module_types",
"@npm//fp-ts",
"@npm//io-ts",
"@npm//tslib",
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 @@ -63,7 +63,7 @@ RUNTIME_DEPS = [

TYPES_DEPS = [
"//packages/kbn-config:npm_module_types",
"//packages/kbn-config-schema",
"//packages/kbn-config-schema:npm_module_types",
"//packages/kbn-dev-utils",
"//packages/kbn-std",
"//packages/kbn-ui-shared-deps-npm",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-server-http-tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUNTIME_DEPS = [
]

TYPES_DEPS = [
"//packages/kbn-config-schema",
"//packages/kbn-config-schema:npm_module_types",
"//packages/kbn-crypto:npm_module_types",
"@npm//@hapi/hapi",
"@npm//@hapi/hoek",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-server-route-repository/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUNTIME_DEPS = [
]

TYPES_DEPS = [
"//packages/kbn-config-schema",
"//packages/kbn-config-schema:npm_module_types",
"//packages/kbn-io-ts-utils",
"@npm//@hapi/boom",
"@npm//fp-ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUNTIME_DEPS = [
]

TYPES_DEPS = [
"//packages/kbn-config-schema",
"//packages/kbn-config-schema:npm_module_types",
"@npm//load-json-file",
"@npm//tslib",
"@npm//@types/jest",
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Boom from '@hapi/boom';
import { ByteSizeValue } from '@kbn/config-schema';
import { CliArgs } from '@kbn/config';
import type { ClientOptions } from '@elastic/elasticsearch/lib/client';
import { ConditionalType } from '@kbn/config-schema/target_types/types';
import { ConditionalType } from '@kbn/config-schema';
import { ConfigDeprecation } from '@kbn/config';
import { ConfigDeprecationContext } from '@kbn/config';
import { ConfigDeprecationFactory } from '@kbn/config';
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5824,6 +5824,10 @@
version "0.0.0"
uid ""

"@types/kbn__config-schema@link:bazel-bin/packages/kbn-config-schema/npm_module_types":
version "0.0.0"
uid ""

"@types/kbn__config@link:bazel-bin/packages/kbn-config/npm_module_types":
version "0.0.0"
uid ""
Expand Down

0 comments on commit 9d6955c

Please sign in to comment.