Skip to content

Commit 1274024

Browse files
authored
chore(NA): moving @kbn/securitysolution-list-api to babel transpiler (#110265)
* chore(NA): moving @kbn/securitysolution-list-api to babel transpiler * chore(NA): add web targets
1 parent c92978b commit 1274024

File tree

5 files changed

+39
-12
lines changed

5 files changed

+39
-12
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["@kbn/babel-preset/node_preset"],
3+
"ignore": ["**/*.test.ts", "**/*.test.tsx"]
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["@kbn/babel-preset/webpack_preset"],
3+
"ignore": ["**/*.test.ts", "**/*.test.tsx"]
4+
}

packages/kbn-securitysolution-list-api/BUILD.bazel

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
22
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
3+
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
34

45
PKG_BASE_NAME = "kbn-securitysolution-list-api"
56

@@ -27,21 +28,36 @@ NPM_MODULE_EXTRA_FILES = [
2728
"README.md",
2829
]
2930

30-
SRC_DEPS = [
31+
RUNTIME_DEPS = [
32+
"//packages/kbn-securitysolution-io-ts-list-types",
3133
"//packages/kbn-securitysolution-io-ts-utils",
3234
"//packages/kbn-securitysolution-list-constants",
33-
"//packages/kbn-securitysolution-io-ts-list-types",
3435
"@npm//fp-ts",
3536
"@npm//io-ts",
36-
"@npm//tslib",
3737
]
3838

3939
TYPES_DEPS = [
40+
"//packages/kbn-securitysolution-io-ts-list-types",
41+
"//packages/kbn-securitysolution-io-ts-utils",
42+
"//packages/kbn-securitysolution-list-constants",
43+
"@npm//fp-ts",
44+
"@npm//io-ts",
4045
"@npm//@types/jest",
4146
"@npm//@types/node",
4247
]
4348

44-
DEPS = SRC_DEPS + TYPES_DEPS
49+
jsts_transpiler(
50+
name = "target_node",
51+
srcs = SRCS,
52+
build_pkg_name = package_name(),
53+
)
54+
55+
jsts_transpiler(
56+
name = "target_web",
57+
srcs = SRCS,
58+
build_pkg_name = package_name(),
59+
config_file = ".babelrc.browser"
60+
)
4561

4662
ts_config(
4763
name = "tsconfig",
@@ -53,24 +69,25 @@ ts_config(
5369
)
5470

5571
ts_project(
56-
name = "tsc",
72+
name = "tsc_types",
5773
srcs = SRCS,
74+
deps = TYPES_DEPS,
5875
args = ["--pretty"],
5976
declaration = True,
6077
declaration_map = True,
61-
out_dir = "target",
78+
emit_declaration_only = True,
79+
out_dir = "target_types",
6280
root_dir = "src",
6381
source_map = True,
6482
tsconfig = ":tsconfig",
65-
deps = DEPS,
6683
)
6784

6885
js_library(
6986
name = PKG_BASE_NAME,
70-
package_name = PKG_REQUIRE_NAME,
7187
srcs = NPM_MODULE_EXTRA_FILES,
88+
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
89+
package_name = PKG_REQUIRE_NAME,
7290
visibility = ["//visibility:public"],
73-
deps = DEPS + [":tsc"],
7491
)
7592

7693
pkg_npm(

packages/kbn-securitysolution-list-api/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "1.0.0",
44
"description": "security solution list REST API",
55
"license": "SSPL-1.0 OR Elastic License 2.0",
6-
"main": "./target/index.js",
7-
"types": "./target/index.d.ts",
6+
"browser": "./target_web/index.js",
7+
"main": "./target_node/index.js",
8+
"types": "./target_types/index.d.ts",
89
"private": true
910
}

packages/kbn-securitysolution-list-api/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"compilerOptions": {
44
"declaration": true,
55
"declarationMap": true,
6-
"outDir": "target",
6+
"emitDeclarationOnly": true,
7+
"outDir": "target_types",
78
"rootDir": "src",
89
"sourceMap": true,
910
"sourceRoot": "../../../../packages/kbn-securitysolution-list-api/src",

0 commit comments

Comments
 (0)