From 9a17760773f959a2768244201342167b2ce97d8d Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 26 Aug 2021 16:36:17 +0100 Subject: [PATCH] chore(NA): moving @kbn/securitysolution-list-constants to babel transpiler --- .../.babelrc | 4 ++++ .../BUILD.bazel | 22 +++++++++++-------- .../package.json | 4 ++-- .../tsconfig.json | 3 ++- 4 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 packages/kbn-securitysolution-list-constants/.babelrc diff --git a/packages/kbn-securitysolution-list-constants/.babelrc b/packages/kbn-securitysolution-list-constants/.babelrc new file mode 100644 index 00000000000000..40a198521b9035 --- /dev/null +++ b/packages/kbn-securitysolution-list-constants/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"], + "ignore": ["**/*.test.ts", "**/*.test.tsx"] +} diff --git a/packages/kbn-securitysolution-list-constants/BUILD.bazel b/packages/kbn-securitysolution-list-constants/BUILD.bazel index e56c96e0b5da91..a9d6a46107318c 100644 --- a/packages/kbn-securitysolution-list-constants/BUILD.bazel +++ b/packages/kbn-securitysolution-list-constants/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-list-constants" @@ -27,16 +28,18 @@ NPM_MODULE_EXTRA_FILES = [ "README.md", ] -SRC_DEPS = [ - "@npm//tslib", -] +RUNTIME_DEPS = [] TYPES_DEPS = [ "@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", @@ -48,24 +51,25 @@ ts_config( ) ts_project( - name = "tsc", + name = "tsc_types", srcs = SRCS, + deps = TYPES_DEPS, args = ["--pretty"], 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-list-constants/package.json b/packages/kbn-securitysolution-list-constants/package.json index b9d65734aff56c..2f35fda7004404 100644 --- a/packages/kbn-securitysolution-list-constants/package.json +++ b/packages/kbn-securitysolution-list-constants/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "security solution list constants 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-list-constants/tsconfig.json b/packages/kbn-securitysolution-list-constants/tsconfig.json index 769b5df990e6b5..8697cbd61580a8 100644 --- a/packages/kbn-securitysolution-list-constants/tsconfig.json +++ b/packages/kbn-securitysolution-list-constants/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-list-constants/src",