From 450bd4b5413edeb93cb31101b94bf64e11cb70f3 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 20 Aug 2021 12:44:25 +0100 Subject: [PATCH 1/4] chore(NA): moving @kbn/securitysolution-es-utils to babel transpiler --- .../kbn-securitysolution-es-utils/.babelrc | 3 +++ .../kbn-securitysolution-es-utils/BUILD.bazel | 25 +++++++++++++------ .../package.json | 4 +-- .../tsconfig.json | 3 ++- 4 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 packages/kbn-securitysolution-es-utils/.babelrc diff --git a/packages/kbn-securitysolution-es-utils/.babelrc b/packages/kbn-securitysolution-es-utils/.babelrc new file mode 100644 index 0000000000000..7da72d1779128 --- /dev/null +++ b/packages/kbn-securitysolution-es-utils/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"] +} diff --git a/packages/kbn-securitysolution-es-utils/BUILD.bazel b/packages/kbn-securitysolution-es-utils/BUILD.bazel index 97f2d9a41cd78..b8c95af64d58b 100644 --- a/packages/kbn-securitysolution-es-utils/BUILD.bazel +++ b/packages/kbn-securitysolution-es-utils/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-securitysolution-es-utils" @@ -27,18 +28,25 @@ NPM_MODULE_EXTRA_FILES = [ "README.md", ] -SRC_DEPS = [ +RUNTIME_DEPS = [ "@npm//@elastic/elasticsearch", "@npm//@hapi/hapi", "@npm//tslib", ] TYPES_DEPS = [ + "@npm//@elastic/elasticsearch", + "@npm//@hapi/hapi", + "@npm//tslib", "@npm//@types/jest", "@npm//@types/node", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) ts_config( name = "tsconfig", @@ -50,24 +58,25 @@ ts_config( ) ts_project( - name = "tsc", - srcs = SRCS, + name = "tsc_types", args = ["--pretty"], + srcs = SRCS, + deps = TYPES_DEPS, declaration = True, declaration_map = True, - out_dir = "target", + emit_declaration_only = True, + out_dir = "target_types", root_dir = "src", source_map = True, tsconfig = ":tsconfig", - deps = DEPS, ) js_library( name = PKG_BASE_NAME, - package_name = PKG_REQUIRE_NAME, srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], + package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], - deps = DEPS + [":tsc"], ) pkg_npm( diff --git a/packages/kbn-securitysolution-es-utils/package.json b/packages/kbn-securitysolution-es-utils/package.json index 7d0c0993c6c32..84c16ad0b7992 100644 --- a/packages/kbn-securitysolution-es-utils/package.json +++ b/packages/kbn-securitysolution-es-utils/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "security solution elastic search utilities to use across plugins such lists, security_solution, cases, etc...", "license": "SSPL-1.0 OR Elastic License 2.0", - "main": "./target/index.js", - "types": "./target/index.d.ts", + "main": "./target_node/index.js", + "types": "./target_types/index.d.ts", "private": true } diff --git a/packages/kbn-securitysolution-es-utils/tsconfig.json b/packages/kbn-securitysolution-es-utils/tsconfig.json index 906b01c943ab7..e5b1c99d3f598 100644 --- a/packages/kbn-securitysolution-es-utils/tsconfig.json +++ b/packages/kbn-securitysolution-es-utils/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "declaration": true, "declarationMap": true, - "outDir": "target", + "emitDeclarationOnly": true, + "outDir": "target_types", "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-securitysolution-es-utils/src", From 2588534c0f893f3ea433dd02b2d651eef75b1f1f Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 20 Aug 2021 17:10:18 +0100 Subject: [PATCH 2/4] chore(NA): update packages/kbn-securitysolution-es-utils/.babelrc Co-authored-by: Frank Hassanabad --- packages/kbn-securitysolution-es-utils/.babelrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/kbn-securitysolution-es-utils/.babelrc b/packages/kbn-securitysolution-es-utils/.babelrc index 7da72d1779128..40a198521b903 100644 --- a/packages/kbn-securitysolution-es-utils/.babelrc +++ b/packages/kbn-securitysolution-es-utils/.babelrc @@ -1,3 +1,4 @@ { - "presets": ["@kbn/babel-preset/node_preset"] + "presets": ["@kbn/babel-preset/node_preset"], + "ignore": ["**/*.test.ts", "**/*.test.tsx"] } From 72268250d191281bda99564bb5b4b843b4e8b5d1 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 20 Aug 2021 21:47:26 +0100 Subject: [PATCH 3/4] chore(NA): correct deps --- packages/kbn-securitysolution-es-utils/BUILD.bazel | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/kbn-securitysolution-es-utils/BUILD.bazel b/packages/kbn-securitysolution-es-utils/BUILD.bazel index b8c95af64d58b..7482b0c247a10 100644 --- a/packages/kbn-securitysolution-es-utils/BUILD.bazel +++ b/packages/kbn-securitysolution-es-utils/BUILD.bazel @@ -30,14 +30,14 @@ NPM_MODULE_EXTRA_FILES = [ RUNTIME_DEPS = [ "@npm//@elastic/elasticsearch", + "@npm//@hapi/boom", "@npm//@hapi/hapi", - "@npm//tslib", ] TYPES_DEPS = [ "@npm//@elastic/elasticsearch", - "@npm//@hapi/hapi", - "@npm//tslib", + "@npm//@hapi/boom", + "@npm//@types/hapi__hapi", "@npm//@types/jest", "@npm//@types/node", ] From b118cba0ea37f36a52b0ee2466815af0c9388260 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 20 Aug 2021 22:01:04 +0100 Subject: [PATCH 4/4] chore(NA): finetunning package --- packages/kbn-securitysolution-es-utils/BUILD.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/kbn-securitysolution-es-utils/BUILD.bazel b/packages/kbn-securitysolution-es-utils/BUILD.bazel index 7482b0c247a10..49c23488b3fe3 100644 --- a/packages/kbn-securitysolution-es-utils/BUILD.bazel +++ b/packages/kbn-securitysolution-es-utils/BUILD.bazel @@ -32,11 +32,13 @@ RUNTIME_DEPS = [ "@npm//@elastic/elasticsearch", "@npm//@hapi/boom", "@npm//@hapi/hapi", + "@npm//tslib", ] TYPES_DEPS = [ "@npm//@elastic/elasticsearch", "@npm//@hapi/boom", + "@npm//tslib", "@npm//@types/hapi__hapi", "@npm//@types/jest", "@npm//@types/node",