Skip to content

Commit

Permalink
chore(NA): moving @kbn/securitysolution-hook-utils to babel transpiler (
Browse files Browse the repository at this point in the history
#109432) (#109667)

* chore(NA): moving @kbn/securitysolution-hook-utils to babel transpiler

* chore(NA): update packages/kbn-securitysolution-hook-utils/.babelrc

Co-authored-by: Frank Hassanabad <frankhassanabad@gmail.com>

* chore(NA): correct deps

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Frank Hassanabad <frankhassanabad@gmail.com>
# Conflicts:
#	packages/kbn-securitysolution-hook-utils/BUILD.bazel
#	packages/kbn-securitysolution-hook-utils/tsconfig.json
  • Loading branch information
mistic authored Aug 23, 2021
1 parent e6fc8f7 commit 91e17d9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
4 changes: 4 additions & 0 deletions packages/kbn-securitysolution-hook-utils/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@kbn/babel-preset/node_preset"],
"ignore": ["**/*.test.ts", "**/*.test.tsx"]
}
28 changes: 19 additions & 9 deletions packages/kbn-securitysolution-hook-utils/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-securitysolution-hook-utils"

Expand Down Expand Up @@ -27,19 +28,27 @@ NPM_MODULE_EXTRA_FILES = [
"README.md",
]

SRC_DEPS = [
RUNTIME_DEPS = [
"@npm//@testing-library/react-hooks",
"@npm//react",
"@npm//rxjs",
"@npm//tslib",
]

TYPES_DEPS = [
"@npm//@testing-library/react-hooks",
"@npm//rxjs",
"@npm//tslib",
"@npm//@types/jest",
"@npm//@types/node",
"@npm//@types/react",
]

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

ts_config(
name = "tsconfig",
Expand All @@ -50,25 +59,26 @@ ts_config(
)

ts_project(
name = "tsc",
srcs = SRCS,
name = "tsc_types",
args = ["--pretty"],
srcs = SRCS,
deps = TYPES_DEPS,
declaration = True,
declaration_map = True,
incremental = True,
out_dir = "target",
emit_declaration_only = True,
incremental = False,
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(
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-securitysolution-hook-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "Security Solution utilities for React hooks",
"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
}
5 changes: 3 additions & 2 deletions packages/kbn-securitysolution-hook-utils/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-securitysolution-hook-utils/src",
Expand Down

0 comments on commit 91e17d9

Please sign in to comment.