Skip to content

Commit

Permalink
chore(NA): moving @kbn/babel-code-parser into bazel (elastic#97675) (e…
Browse files Browse the repository at this point in the history
…lastic#98185)

* chore(NA): moving @kbn/babel-code-parser into bazel

* docs(NA): missing docs about new package

* chore(NA): removing quiet arg

* chore(NA): fix packages build srcs

* chore(NA): change source order on tinymath

* chore(NA): add babelrc

* chore(NA): clear package build migration

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
  • Loading branch information
kibanamachine and mistic committed Apr 23, 2021
1 parent ce1421b commit fd17880
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 15 deletions.
1 change: 1 addition & 0 deletions docs/developer/getting-started/monorepo-packages.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ yarn kbn watch-bazel

- @elastic/datemath
- @kbn/apm-utils
- @kbn/babel-code-parser
- @kbn/babel-preset
- @kbn/config-schema
- @kbn/std
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
"@elastic/makelogs": "^6.0.0",
"@istanbuljs/schema": "^0.1.2",
"@jest/reporters": "^26.6.2",
"@kbn/babel-code-parser": "link:packages/kbn-babel-code-parser",
"@kbn/babel-code-parser": "link:bazel-bin/packages/kbn-babel-code-parser/npm_module",
"@kbn/babel-preset": "link:bazel-bin/packages/kbn-babel-preset/npm_module",
"@kbn/cli-dev-mode": "link:packages/kbn-cli-dev-mode",
"@kbn/dev-utils": "link:packages/kbn-dev-utils",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ filegroup(
srcs = [
"//packages/elastic-datemath:build",
"//packages/kbn-apm-utils:build",
"//packages/kbn-babel-code-parser:build",
"//packages/kbn-babel-preset:build",
"//packages/kbn-config-schema:build",
"//packages/kbn-std:build",
Expand Down
3 changes: 1 addition & 2 deletions packages/elastic-datemath/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,14 @@ ts_project(

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

pkg_npm(
name = "npm_module",
srcs = NPM_MODULE_EXTRA_FILES,
deps = [
":%s" % PKG_BASE_NAME,
]
Expand Down
3 changes: 1 addition & 2 deletions packages/kbn-apm-utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@ ts_project(

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

pkg_npm(
name = "npm_module",
srcs = NPM_MODULE_EXTRA_FILES,
deps = [
":%s" % PKG_BASE_NAME,
]
Expand Down
71 changes: 71 additions & 0 deletions packages/kbn-babel-code-parser/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("@npm//@babel/cli:index.bzl", "babel")

PKG_BASE_NAME = "kbn-babel-code-parser"
PKG_REQUIRE_NAME = "@kbn/babel-code-parser"

SOURCE_FILES = glob(
[
"src/**/*",
],
exclude = [
"**/*.test.*"
],
)

SRCS = SOURCE_FILES

filegroup(
name = "srcs",
srcs = SRCS,
)

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

DEPS = [
"//packages/kbn-babel-preset",
"@npm//@babel/parser",
"@npm//@babel/traverse",
"@npm//lodash",
]

babel(
name = "target",
data = [
":srcs",
".babelrc",
] + DEPS,
output_dir = True,
args = [
"./%s/src" % package_name(),
"--out-dir",
"$(@D)",
"--quiet"
],
)

js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = [":target"] + DEPS,
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)

pkg_npm(
name = "npm_module",
deps = [
":%s" % PKG_BASE_NAME,
]
)

filegroup(
name = "build",
srcs = [
":npm_module",
],
visibility = ["//visibility:public"],
)
5 changes: 0 additions & 5 deletions packages/kbn-babel-code-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,5 @@
"repository": {
"type": "git",
"url": "https://github.com/elastic/kibana/tree/master/packages/kbn-babel-code-parser"
},
"scripts": {
"build": "../../node_modules/.bin/babel src --out-dir target",
"kbn:bootstrap": "yarn build --quiet",
"kbn:watch": "yarn build --watch"
}
}
3 changes: 1 addition & 2 deletions packages/kbn-babel-preset/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DEPS = [

js_library(
name = PKG_BASE_NAME,
srcs = [
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
],
deps = DEPS,
Expand All @@ -48,7 +48,6 @@ js_library(

pkg_npm(
name = "npm_module",
srcs = NPM_MODULE_EXTRA_FILES,
deps = [
":%s" % PKG_BASE_NAME,
]
Expand Down
3 changes: 1 addition & 2 deletions packages/kbn-tinymath/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ peggy(

js_library(
name = PKG_BASE_NAME,
srcs = [
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
":grammar"
],
Expand All @@ -56,7 +56,6 @@ js_library(

pkg_npm(
name = "npm_module",
srcs = NPM_MODULE_EXTRA_FILES,
deps = [
":%s" % PKG_BASE_NAME,
]
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2585,7 +2585,7 @@
version "0.0.0"
uid ""

"@kbn/babel-code-parser@link:packages/kbn-babel-code-parser":
"@kbn/babel-code-parser@link:bazel-bin/packages/kbn-babel-code-parser/npm_module":
version "0.0.0"
uid ""

Expand Down

0 comments on commit fd17880

Please sign in to comment.