From 212242381255ad6e983095e13c9bdc23f71cb975 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 27 Jul 2021 22:28:53 +0100 Subject: [PATCH 1/3] chore(NA): moving @kbn/config-schema to babel transpiler --- packages/kbn-config-schema/.babelrc | 3 +++ packages/kbn-config-schema/BUILD.bazel | 26 +++++++++++++----------- packages/kbn-config-schema/package.json | 4 ++-- packages/kbn-config-schema/tsconfig.json | 5 +++-- 4 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 packages/kbn-config-schema/.babelrc diff --git a/packages/kbn-config-schema/.babelrc b/packages/kbn-config-schema/.babelrc new file mode 100644 index 0000000000000..7da72d1779128 --- /dev/null +++ b/packages/kbn-config-schema/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"] +} diff --git a/packages/kbn-config-schema/BUILD.bazel b/packages/kbn-config-schema/BUILD.bazel index 1ae4fa5eeeb27..a2e47a7e68a3f 100644 --- a/packages/kbn-config-schema/BUILD.bazel +++ b/packages/kbn-config-schema/BUILD.bazel @@ -1,5 +1,6 @@ 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") PKG_BASE_NAME = "kbn-config-schema" PKG_REQUIRE_NAME = "@kbn/config-schema" @@ -21,15 +22,9 @@ NPM_MODULE_EXTRA_FILES = [ "README.md", ] -SRC_DEPS = [ - "@npm//joi", - "@npm//lodash", +TYPES_DEPS = [ "@npm//moment", "@npm//tsd", - "@npm//type-detect", -] - -TYPES_DEPS = [ "@npm//@types/jest", "@npm//@types/joi", "@npm//@types/lodash", @@ -37,7 +32,13 @@ TYPES_DEPS = [ "@npm//@types/type-detect", ] -DEPS = SRC_DEPS + TYPES_DEPS +DEPS = TYPES_DEPS + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) ts_config( name = "tsconfig", @@ -48,14 +49,15 @@ ts_config( ) ts_project( - name = "tsc", + name = "tsc_types", args = ['--pretty'], srcs = SRCS, deps = DEPS, declaration = True, declaration_map = True, - incremental = True, - out_dir = "target", + emit_declaration_only = True, + incremental = False, + out_dir = "target_types", source_map = True, root_dir = "src", tsconfig = ":tsconfig", @@ -64,7 +66,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = DEPS + [":tsc"], + deps = [":target_node", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-config-schema/package.json b/packages/kbn-config-schema/package.json index 85b52f5d75533..a3b6880c3293c 100644 --- a/packages/kbn-config-schema/package.json +++ b/packages/kbn-config-schema/package.json @@ -1,7 +1,7 @@ { "name": "@kbn/config-schema", - "main": "./target/index.js", - "types": "./target/index.d.ts", + "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/packages/kbn-config-schema/tsconfig.json b/packages/kbn-config-schema/tsconfig.json index eee6900f07327..de9476bbbb35c 100644 --- a/packages/kbn-config-schema/tsconfig.json +++ b/packages/kbn-config-schema/tsconfig.json @@ -3,8 +3,9 @@ "compilerOptions": { "declaration": true, "declarationMap": true, - "incremental": true, - "outDir": "target", + "emitDeclarationOnly": true, + "incremental": false, + "outDir": "target_types", "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-config-schema/src", From 60ee3769e873b17f5dcb14befd81faba856b2d58 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 27 Jul 2021 23:09:56 +0100 Subject: [PATCH 2/3] chore(NA): added runtime deps --- packages/kbn-config-schema/BUILD.bazel | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/kbn-config-schema/BUILD.bazel b/packages/kbn-config-schema/BUILD.bazel index a2e47a7e68a3f..2a4718b87df14 100644 --- a/packages/kbn-config-schema/BUILD.bazel +++ b/packages/kbn-config-schema/BUILD.bazel @@ -22,6 +22,14 @@ NPM_MODULE_EXTRA_FILES = [ "README.md", ] +RUNTIME_DEPS = [ + "@npm//joi", + "@npm//lodash", + "@npm//moment", + "@npm//tsd", + "@npm//type-detect", +] + TYPES_DEPS = [ "@npm//moment", "@npm//tsd", @@ -32,8 +40,6 @@ TYPES_DEPS = [ "@npm//@types/type-detect", ] -DEPS = TYPES_DEPS - jsts_transpiler( name = "target_node", srcs = SRCS, @@ -52,7 +58,7 @@ ts_project( name = "tsc_types", args = ['--pretty'], srcs = SRCS, - deps = DEPS, + deps = TYPES_DEPS, declaration = True, declaration_map = True, emit_declaration_only = True, @@ -66,7 +72,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = [":target_node", ":tsc_types"], + deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) From c25583b7e0594f9f29e4f54118591a6735cb3d8b Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 27 Jul 2021 23:29:25 +0100 Subject: [PATCH 3/3] chore(NA): update api extractions --- src/core/server/server.api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index 6bc1bb5880e0c..47782c2f98d3a 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -372,7 +372,7 @@ export const config: { healthCheck: import("@kbn/config-schema").ObjectType<{ delay: Type; }>; - ignoreVersionMismatch: import("@kbn/config-schema/target/types").ConditionalType; + ignoreVersionMismatch: import("@kbn/config-schema/target_types/types").ConditionalType; }>; }; logging: {