Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] chore(NA): moving @kbn/ace to babel transpiler (#106922) #107056

Merged
merged 1 commit into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/kbn-ace/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": ["@kbn/babel-preset/node_preset"],
"ignore": [
"src/ace/modes/x_json/worker/x_json.ace.worker.js"
]
}
26 changes: 19 additions & 7 deletions packages/kbn-ace/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
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-ace"
PKG_REQUIRE_NAME = "@kbn/ace"

SOURCE_FILES = glob(
[
"src/**/*.ts",
"src/ace/modes/x_json/worker/x_json.ace.worker.js",
],
exclude = [
"src/ace/modes/x_json/worker/worker.d.ts",
Expand All @@ -26,18 +28,27 @@ NPM_MODULE_EXTRA_FILES = [
"README.md"
]

SRC_DEPS = [
RUNTIME_DEPS = [
"@npm//brace",
"@npm//lodash",
"@npm//raw-loader",
]

TYPES_DEPS = [
"@npm//brace",
"@npm//@types/lodash",
"@npm//@types/node",
]

DEPS = SRC_DEPS + TYPES_DEPS
jsts_transpiler(
name = "target_node",
srcs = SRCS,
additional_args = [
"--copy-files",
"--quiet"
],
build_pkg_name = package_name(),
)

ts_config(
name = "tsconfig",
Expand All @@ -48,14 +59,15 @@ ts_config(
)

ts_project(
name = "tsc",
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
deps = TYPES_DEPS,
declaration = True,
declaration_map = True,
incremental = True,
out_dir = "target",
emit_declaration_only = True,
incremental = False,
out_dir = "target_types",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig",
Expand All @@ -64,7 +76,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = DEPS + [":tsc"],
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-ace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@kbn/ace",
"version": "1.0.0",
"private": true,
"main": "./target/index.js",
"types": "./target/index.d.ts",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
5 changes: 3 additions & 2 deletions packages/kbn-ace/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": true,
"outDir": "./target",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"incremental": false,
"outDir": "./target_types",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-ace/src",
"stripInternal": true,
Expand Down