Skip to content

Commit

Permalink
chore(NA): moving @kbn/securitysolution-t-grid to babel transpiler (e…
Browse files Browse the repository at this point in the history
…lastic#109442)

* 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]>
# Conflicts:
#	packages/kbn-securitysolution-t-grid/BUILD.bazel
#	packages/kbn-securitysolution-t-grid/tsconfig.browser.json
#	packages/kbn-securitysolution-t-grid/tsconfig.json
  • Loading branch information
mistic committed Aug 23, 2021
1 parent 99855de commit 97400c6
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 93 deletions.
4 changes: 4 additions & 0 deletions packages/kbn-securitysolution-t-grid/.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"]
}
4 changes: 4 additions & 0 deletions packages/kbn-securitysolution-t-grid/.babelrc.browser
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@kbn/babel-preset/webpack_preset"],
"ignore": ["**/*.test.ts", "**/*.test.tsx"]
}
65 changes: 22 additions & 43 deletions packages/kbn-securitysolution-t-grid/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-t-grid"

Expand All @@ -24,36 +25,37 @@ filegroup(
)

NPM_MODULE_EXTRA_FILES = [
"react/package.json",
"package.json",
"README.md",
]

SRC_DEPS = [
"//packages/kbn-babel-preset",
"//packages/kbn-dev-utils",
"//packages/kbn-i18n",
"@npm//@babel/core",
"@npm//babel-loader",
"@npm//enzyme",
RUNTIME_DEPS = [
"@npm//jest",
"@npm//lodash",
"@npm//react",
"@npm//react-beautiful-dnd",
"@npm//tslib",
]

TYPES_DEPS = [
"@npm//typescript",
"@npm//@types/enzyme",
"@npm//tslib",
"@npm//@types/jest",
"@npm//@types/lodash",
"@npm//@types/node",
"@npm//@types/react",
"@npm//@types/react-beautiful-dnd",
]

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

jsts_transpiler(
name = "target_web",
srcs = SRCS,
build_pkg_name = package_name(),
config_file = ".babelrc.browser"
)

ts_config(
name = "tsconfig",
Expand All @@ -63,50 +65,27 @@ ts_config(
],
)

ts_config(
name = "tsconfig_browser",
src = "tsconfig.browser.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.browser.json",
],
)

ts_project(
name = "tsc",
name = "tsc_types",
args = ["--pretty"],
srcs = SRCS,
deps = DEPS,
deps = TYPES_DEPS,
declaration = True,
declaration_dir = "target_types",
declaration_map = True,
incremental = True,
out_dir = "target_node",
emit_declaration_only = True,
incremental = False,
out_dir = "target_types",
root_dir = "src",
source_map = True,
tsconfig = ":tsconfig",
)

ts_project(
name = "tsc_browser",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
allow_js = True,
declaration = False,
incremental = True,
out_dir = "target_web",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig_browser",
)

js_library(
name = PKG_BASE_NAME,
package_name = PKG_REQUIRE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
deps = [":tsc", ":tsc_browser"] + DEPS,
)

pkg_npm(
Expand Down
19 changes: 0 additions & 19 deletions packages/kbn-securitysolution-t-grid/babel.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/kbn-securitysolution-t-grid/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 t-grid packages will allow sharing components between timelines and security_solution plugin until we transfer all functionality to timelines plugin",
"license": "SSPL-1.0 OR Elastic License 2.0",
"browser": "./target_web/browser.js",
"browser": "./target_web/index.js",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"private": true
Expand Down
5 changes: 0 additions & 5 deletions packages/kbn-securitysolution-t-grid/react/package.json

This file was deleted.

23 changes: 0 additions & 23 deletions packages/kbn-securitysolution-t-grid/tsconfig.browser.json

This file was deleted.

5 changes: 3 additions & 2 deletions packages/kbn-securitysolution-t-grid/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-t-grid/src",
Expand Down

0 comments on commit 97400c6

Please sign in to comment.