Skip to content

Commit

Permalink
chore(NA): moving @kbn/es into bazel (#99371)
Browse files Browse the repository at this point in the history
* chore(NA): moving @kbn/es into bazel

* chore(NA): remove build scripts from pkg json

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
mistic and kibanamachine authored May 5, 2021
1 parent 24734a3 commit 43d3a97
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 70 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 @@ -73,6 +73,7 @@ yarn kbn watch-bazel
- @kbn/config-schema
- @kbn/crypto
- @kbn/dev-utils
- @kbn/es
- @kbn/eslint-import-resolver-kibana
- @kbn/eslint-plugin-eslint
- @kbn/expect
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@
"@kbn/cli-dev-mode": "link:packages/kbn-cli-dev-mode",
"@kbn/dev-utils": "link:bazel-bin/packages/kbn-dev-utils/npm_module",
"@kbn/docs-utils": "link:packages/kbn-docs-utils",
"@kbn/es": "link:packages/kbn-es",
"@kbn/es": "link:bazel-bin/packages/kbn-es/npm_module",
"@kbn/es-archiver": "link:packages/kbn-es-archiver",
"@kbn/eslint-import-resolver-kibana": "link:bazel-bin/packages/kbn-eslint-import-resolver-kibana/npm_module",
"@kbn/eslint-plugin-eslint": "link:bazel-bin/packages/kbn-eslint-plugin-eslint/npm_module",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ filegroup(
"//packages/kbn-config-schema:build",
"//packages/kbn-crypto:build",
"//packages/kbn-dev-utils:build",
"//packages/kbn-es:build",
"//packages/kbn-eslint-import-resolver-kibana:build",
"//packages/kbn-eslint-plugin-eslint:build",
"//packages/kbn-expect:build",
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-es/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/node_preset"]
}
90 changes: 90 additions & 0 deletions packages/kbn-es/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("@npm//@babel/cli:index.bzl", "babel")

PKG_BASE_NAME = "kbn-es"
PKG_REQUIRE_NAME = "@kbn/es"

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

SRCS = SOURCE_FILES

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

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

DEPS = [
"//packages/kbn-babel-preset",
"@npm//@elastic/elasticsearch",
"@npm//abort-controller",
"@npm//chalk",
"@npm//dedent",
"@npm//del",
"@npm//execa",
"@npm//getopts",
"@npm//glob",
"@npm//node-fetch",
"@npm//simple-git",
"@npm//tar-fs",
"@npm//tree-kill",
"@npm//yauzl",
"@npm//zlib"
]

babel(
name = "target",
data = [
":srcs",
".babelrc",
] + DEPS,
output_dir = True,
# the following arg paths includes $(execpath) as babel runs on the sandbox root
args = [
"./%s/src" % package_name(),
"--config-file",
"./%s/.babelrc" % package_name(),
"--out-dir",
"$(@D)",
"--extensions",
".ts,.js",
"--copy-files",
"--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-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@
"private": true,
"kibana": {
"devOnly": true
},
"scripts": {
"build": "node scripts/build",
"kbn:bootstrap": "node scripts/build",
"kbn:watch": "node scripts/build --watch"
}
}
60 changes: 0 additions & 60 deletions packages/kbn-es/scripts/build.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/kbn-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"devOnly": true
},
"dependencies": {
"@kbn/es": "link:../kbn-es",
"@kbn/i18n": "link:../kbn-i18n",
"@kbn/optimizer": "link:../kbn-optimizer"
}
Expand Down
1 change: 0 additions & 1 deletion x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"yarn": "^1.21.1"
},
"devDependencies": {
"@kbn/es": "link:../packages/kbn-es",
"@kbn/plugin-helpers": "link:../packages/kbn-plugin-helpers",
"@kbn/storybook": "link:../packages/kbn-storybook",
"@kbn/test": "link:../packages/kbn-test"
Expand Down
10 changes: 8 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2635,7 +2635,7 @@
version "0.0.0"
uid ""

"@kbn/es@link:packages/kbn-es":
"@kbn/es@link:bazel-bin/packages/kbn-es/npm_module":
version "0.0.0"
uid ""

Expand Down Expand Up @@ -2692,11 +2692,17 @@
uid ""

"@kbn/securitysolution-constants@link:bazel-bin/packages/kbn-securitysolution-constants/npm_module":
"@kbn/securitysolution-utils@link:bazel-bin/packages/kbn-securitysolution-utils/npm_module":
version "0.0.0"
uid ""

"@kbn/securitysolution-io-ts-utils@link:bazel-bin/packages/kbn-securitysolution-io-ts-utils/npm_module":
version "0.0.0"
uid ""

"@kbn/securitysolution-utils@link:bazel-bin/packages/kbn-securitysolution-utils/npm_module":
version "0.0.0"
uid ""

"@kbn/server-http-tools@link:packages/kbn-server-http-tools":
version "0.0.0"
uid ""
Expand Down

0 comments on commit 43d3a97

Please sign in to comment.