Skip to content

Commit c92978b

Browse files
authored
chore(NA): moving @kbn/securitysolution-list-constants to babel transpiler (#110269)
* chore(NA): moving @kbn/securitysolution-list-constants to babel transpiler * chore(NA): add web targets
1 parent 74f3b76 commit c92978b

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-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-constants/BUILD.bazel

Lines changed: 20 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-constants"
56

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

30-
SRC_DEPS = [
31-
"@npm//tslib",
32-
]
31+
RUNTIME_DEPS = []
3332

3433
TYPES_DEPS = [
3534
"@npm//@types/jest",
3635
"@npm//@types/node",
3736
]
3837

39-
DEPS = SRC_DEPS + TYPES_DEPS
38+
jsts_transpiler(
39+
name = "target_node",
40+
srcs = SRCS,
41+
build_pkg_name = package_name(),
42+
)
43+
44+
jsts_transpiler(
45+
name = "target_web",
46+
srcs = SRCS,
47+
build_pkg_name = package_name(),
48+
config_file = ".babelrc.browser"
49+
)
4050

4151
ts_config(
4252
name = "tsconfig",
@@ -48,24 +58,25 @@ ts_config(
4858
)
4959

5060
ts_project(
51-
name = "tsc",
61+
name = "tsc_types",
5262
srcs = SRCS,
63+
deps = TYPES_DEPS,
5364
args = ["--pretty"],
5465
declaration = True,
5566
declaration_map = True,
56-
out_dir = "target",
67+
emit_declaration_only = True,
68+
out_dir = "target_types",
5769
root_dir = "src",
5870
source_map = True,
5971
tsconfig = ":tsconfig",
60-
deps = DEPS,
6172
)
6273

6374
js_library(
6475
name = PKG_BASE_NAME,
65-
package_name = PKG_REQUIRE_NAME,
6676
srcs = NPM_MODULE_EXTRA_FILES,
77+
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
78+
package_name = PKG_REQUIRE_NAME,
6779
visibility = ["//visibility:public"],
68-
deps = DEPS + [":tsc"],
6980
)
7081

7182
pkg_npm(

packages/kbn-securitysolution-list-constants/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 constants to use across plugins such lists, security_solution, cases, etc...",
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-constants/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-constants/src",

0 commit comments

Comments
 (0)