Skip to content

Commit

Permalink
chore(NA): moving @kbn/config-schema to babel transpiler (#106929) (#…
Browse files Browse the repository at this point in the history
…107087)

* chore(NA): moving @kbn/config-schema to babel transpiler

* chore(NA): added runtime deps

* chore(NA): update api extractions

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Tiago Costa <[email protected]>
  • Loading branch information
kibanamachine and mistic authored Jul 28, 2021
1 parent c6785ab commit 8e5adaa
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
3 changes: 3 additions & 0 deletions packages/kbn-config-schema/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/node_preset"]
}
22 changes: 15 additions & 7 deletions packages/kbn-config-schema/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -21,7 +22,7 @@ NPM_MODULE_EXTRA_FILES = [
"README.md",
]

SRC_DEPS = [
RUNTIME_DEPS = [
"@npm//joi",
"@npm//lodash",
"@npm//moment",
Expand All @@ -30,14 +31,20 @@ SRC_DEPS = [
]

TYPES_DEPS = [
"@npm//moment",
"@npm//tsd",
"@npm//@types/jest",
"@npm//@types/joi",
"@npm//@types/lodash",
"@npm//@types/node",
"@npm//@types/type-detect",
]

DEPS = SRC_DEPS + TYPES_DEPS
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)

ts_config(
name = "tsconfig",
Expand All @@ -48,14 +55,15 @@ ts_config(
)

ts_project(
name = "tsc",
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
deps = TYPES_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",
Expand All @@ -64,7 +72,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = DEPS + [":tsc"],
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-config-schema/package.json
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions packages/kbn-config-schema/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
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 @@ -371,7 +371,7 @@ export const config: {
healthCheck: import("@kbn/config-schema").ObjectType<{
delay: Type<import("moment").Duration>;
}>;
ignoreVersionMismatch: import("@kbn/config-schema/target/types").ConditionalType<false, boolean, boolean>;
ignoreVersionMismatch: import("@kbn/config-schema/target_types/types").ConditionalType<false, boolean, boolean>;
}>;
};
logging: {
Expand Down

0 comments on commit 8e5adaa

Please sign in to comment.