chore(NA): moving @kbn/legacy-logging to babel transpiler (#108703) (#109001)

Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
This commit is contained in:
Kibana Machine 2021-08-17 19:53:06 -04:00 committed by GitHub
parent b6d14af66e
commit d9232d495b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 10 deletions

View file

@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/node_preset"]
}

View file

@ -1,5 +1,6 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
PKG_BASE_NAME = "kbn-legacy-logging" PKG_BASE_NAME = "kbn-legacy-logging"
PKG_REQUIRE_NAME = "@kbn/legacy-logging" PKG_REQUIRE_NAME = "@kbn/legacy-logging"
@ -23,7 +24,7 @@ NPM_MODULE_EXTRA_FILES = [
"README.md" "README.md"
] ]
SRC_DEPS = [ RUNTIME_DEPS = [
"//packages/kbn-config-schema", "//packages/kbn-config-schema",
"//packages/kbn-utils", "//packages/kbn-utils",
"@npm//@elastic/numeral", "@npm//@elastic/numeral",
@ -37,6 +38,13 @@ SRC_DEPS = [
] ]
TYPES_DEPS = [ TYPES_DEPS = [
"//packages/kbn-config-schema",
"//packages/kbn-utils",
"@npm//@elastic/numeral",
"@npm//chokidar",
"@npm//query-string",
"@npm//rxjs",
"@npm//tslib",
"@npm//@types/hapi__hapi", "@npm//@types/hapi__hapi",
"@npm//@types/hapi__podium", "@npm//@types/hapi__podium",
"@npm//@types/jest", "@npm//@types/jest",
@ -45,7 +53,11 @@ TYPES_DEPS = [
"@npm//@types/node", "@npm//@types/node",
] ]
DEPS = SRC_DEPS + TYPES_DEPS jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
ts_config( ts_config(
name = "tsconfig", name = "tsconfig",
@ -57,13 +69,14 @@ ts_config(
) )
ts_project( ts_project(
name = "tsc", name = "tsc_types",
args = ['--pretty'], args = ['--pretty'],
srcs = SRCS, srcs = SRCS,
deps = DEPS, deps = TYPES_DEPS,
declaration = True, declaration = True,
declaration_map = True, declaration_map = True,
out_dir = "target", emit_declaration_only = True,
out_dir = "target_types",
source_map = True, source_map = True,
root_dir = "src", root_dir = "src",
tsconfig = ":tsconfig", tsconfig = ":tsconfig",
@ -72,7 +85,7 @@ ts_project(
js_library( js_library(
name = PKG_BASE_NAME, name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES, srcs = NPM_MODULE_EXTRA_FILES,
deps = DEPS + [":tsc"], deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
package_name = PKG_REQUIRE_NAME, package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )

View file

@ -3,6 +3,6 @@
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"license": "SSPL-1.0 OR Elastic License 2.0", "license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js", "main": "./target_node/index.js",
"types": "./target/index.d.ts" "types": "./target_types/index.d.ts"
} }

View file

@ -1,13 +1,14 @@
{ {
"extends": "../../tsconfig.bazel.json", "extends": "../../tsconfig.bazel.json",
"compilerOptions": { "compilerOptions": {
"outDir": "target",
"stripInternal": false,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src", "rootDir": "src",
"sourceMap": true, "sourceMap": true,
"sourceRoot": "../../../../packages/kbn-legacy-logging/src", "sourceRoot": "../../../../packages/kbn-legacy-logging/src",
"stripInternal": false,
"types": ["jest", "node"] "types": ["jest", "node"]
}, },
"include": ["src/**/*"] "include": ["src/**/*"]