Skip to content

Commit c31154b

Browse files
chore(NA): moving @kbn/securitysolution-t-grid to babel transpiler (#109442) (#109677)
* chore(NA): moving @kbn/securitysolution-t-grid to babel transpiler * chore(NA): fix package.json * chore(NA): finetunning package Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Tiago Costa <[email protected]>
1 parent 3ca3a9a commit c31154b

File tree

8 files changed

+32
-90
lines changed

8 files changed

+32
-90
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-t-grid/BUILD.bazel

Lines changed: 21 additions & 42 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-t-grid"
56

@@ -24,36 +25,37 @@ filegroup(
2425
)
2526

2627
NPM_MODULE_EXTRA_FILES = [
27-
"react/package.json",
2828
"package.json",
2929
"README.md",
3030
]
3131

32-
SRC_DEPS = [
33-
"//packages/kbn-babel-preset",
34-
"//packages/kbn-dev-utils",
35-
"//packages/kbn-i18n",
36-
"@npm//@babel/core",
37-
"@npm//babel-loader",
38-
"@npm//enzyme",
32+
RUNTIME_DEPS = [
3933
"@npm//jest",
4034
"@npm//lodash",
41-
"@npm//react",
4235
"@npm//react-beautiful-dnd",
4336
"@npm//tslib",
4437
]
4538

4639
TYPES_DEPS = [
47-
"@npm//typescript",
48-
"@npm//@types/enzyme",
40+
"@npm//tslib",
4941
"@npm//@types/jest",
5042
"@npm//@types/lodash",
5143
"@npm//@types/node",
52-
"@npm//@types/react",
5344
"@npm//@types/react-beautiful-dnd",
5445
]
5546

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

5860
ts_config(
5961
name = "tsconfig",
@@ -64,49 +66,26 @@ ts_config(
6466
],
6567
)
6668

67-
ts_config(
68-
name = "tsconfig_browser",
69-
src = "tsconfig.browser.json",
70-
deps = [
71-
"//:tsconfig.base.json",
72-
"//:tsconfig.browser.json",
73-
"//:tsconfig.browser_bazel.json",
74-
],
75-
)
76-
7769
ts_project(
78-
name = "tsc",
70+
name = "tsc_types",
7971
args = ["--pretty"],
8072
srcs = SRCS,
81-
deps = DEPS,
73+
deps = TYPES_DEPS,
8274
declaration = True,
83-
declaration_dir = "target_types",
8475
declaration_map = True,
85-
out_dir = "target_node",
76+
emit_declaration_only = True,
77+
out_dir = "target_types",
8678
root_dir = "src",
8779
source_map = True,
8880
tsconfig = ":tsconfig",
8981
)
9082

91-
ts_project(
92-
name = "tsc_browser",
93-
args = ['--pretty'],
94-
srcs = SRCS,
95-
deps = DEPS,
96-
allow_js = True,
97-
declaration = False,
98-
out_dir = "target_web",
99-
source_map = True,
100-
root_dir = "src",
101-
tsconfig = ":tsconfig_browser",
102-
)
103-
10483
js_library(
10584
name = PKG_BASE_NAME,
106-
package_name = PKG_REQUIRE_NAME,
10785
srcs = NPM_MODULE_EXTRA_FILES,
86+
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
87+
package_name = PKG_REQUIRE_NAME,
10888
visibility = ["//visibility:public"],
109-
deps = [":tsc", ":tsc_browser"] + DEPS,
11089
)
11190

11291
pkg_npm(

packages/kbn-securitysolution-t-grid/babel.config.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/kbn-securitysolution-t-grid/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"description": "security solution t-grid packages will allow sharing components between timelines and security_solution plugin until we transfer all functionality to timelines plugin",
55
"license": "SSPL-1.0 OR Elastic License 2.0",
6-
"browser": "./target_web/browser.js",
6+
"browser": "./target_web/index.js",
77
"main": "./target_node/index.js",
88
"types": "./target_types/index.d.ts",
99
"private": true

packages/kbn-securitysolution-t-grid/react/package.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/kbn-securitysolution-t-grid/tsconfig.browser.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/kbn-securitysolution-t-grid/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-t-grid/src",

0 commit comments

Comments
 (0)