chore(NA): moving @kbn/securitysolution-list-api to babel transpiler (#110265) (#110406)

* chore(NA): moving @kbn/securitysolution-list-api to babel transpiler

* chore(NA): add web targets

Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
This commit is contained in:
Kibana Machine 2021-08-27 14:14:49 -04:00 committed by GitHub
parent ac2e4e71b7
commit d7806152af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 12 deletions

View file

@ -0,0 +1,4 @@
{
"presets": ["@kbn/babel-preset/node_preset"],
"ignore": ["**/*.test.ts", "**/*.test.tsx"]
}

View file

@ -0,0 +1,4 @@
{
"presets": ["@kbn/babel-preset/webpack_preset"],
"ignore": ["**/*.test.ts", "**/*.test.tsx"]
}

View file

@ -1,5 +1,6 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
PKG_BASE_NAME = "kbn-securitysolution-list-api" PKG_BASE_NAME = "kbn-securitysolution-list-api"
@ -27,21 +28,36 @@ NPM_MODULE_EXTRA_FILES = [
"README.md", "README.md",
] ]
SRC_DEPS = [ RUNTIME_DEPS = [
"//packages/kbn-securitysolution-io-ts-list-types",
"//packages/kbn-securitysolution-io-ts-utils", "//packages/kbn-securitysolution-io-ts-utils",
"//packages/kbn-securitysolution-list-constants", "//packages/kbn-securitysolution-list-constants",
"//packages/kbn-securitysolution-io-ts-list-types",
"@npm//fp-ts", "@npm//fp-ts",
"@npm//io-ts", "@npm//io-ts",
"@npm//tslib",
] ]
TYPES_DEPS = [ TYPES_DEPS = [
"//packages/kbn-securitysolution-io-ts-list-types",
"//packages/kbn-securitysolution-io-ts-utils",
"//packages/kbn-securitysolution-list-constants",
"@npm//fp-ts",
"@npm//io-ts",
"@npm//@types/jest", "@npm//@types/jest",
"@npm//@types/node", "@npm//@types/node",
] ]
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( ts_config(
name = "tsconfig", name = "tsconfig",
@ -53,24 +69,25 @@ ts_config(
) )
ts_project( ts_project(
name = "tsc", name = "tsc_types",
srcs = SRCS, srcs = SRCS,
deps = TYPES_DEPS,
args = ["--pretty"], args = ["--pretty"],
declaration = True, declaration = True,
declaration_map = True, declaration_map = True,
out_dir = "target", emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src", root_dir = "src",
source_map = True, source_map = True,
tsconfig = ":tsconfig", tsconfig = ":tsconfig",
deps = DEPS,
) )
js_library( js_library(
name = PKG_BASE_NAME, name = PKG_BASE_NAME,
package_name = PKG_REQUIRE_NAME,
srcs = NPM_MODULE_EXTRA_FILES, srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = DEPS + [":tsc"],
) )
pkg_npm( pkg_npm(

View file

@ -3,7 +3,8 @@
"version": "1.0.0", "version": "1.0.0",
"description": "security solution list REST API", "description": "security solution list REST API",
"license": "SSPL-1.0 OR Elastic License 2.0", "license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js", "browser": "./target_web/index.js",
"types": "./target/index.d.ts", "main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"private": true "private": true
} }

View file

@ -3,7 +3,8 @@
"compilerOptions": { "compilerOptions": {
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"outDir": "target", "emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src", "rootDir": "src",
"sourceMap": true, "sourceMap": true,
"sourceRoot": "../../../../packages/kbn-securitysolution-list-api/src", "sourceRoot": "../../../../packages/kbn-securitysolution-list-api/src",