From a5f590d826fbe23c79258be1f6f5121fe9faf50e Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 19 Apr 2021 08:50:36 -0400 Subject: [PATCH] chore(NA): moving @kbn/babel-preset into bazel (#97271) (#97436) * chore(NA): moving @kbn/babel-preset into bazel * chore(NA): remove unused deps from xpack package.json Co-authored-by: Tiago Costa --- .../monorepo-packages.asciidoc | 1 + package.json | 2 +- packages/BUILD.bazel | 1 + packages/kbn-ace/package.json | 3 +- packages/kbn-analytics/package.json | 3 +- packages/kbn-babel-code-parser/package.json | 3 - packages/kbn-babel-preset/BUILD.bazel | 63 +++++++++++++++++++ packages/kbn-dev-utils/package.json | 1 - packages/kbn-es/package.json | 3 - packages/kbn-i18n/package.json | 1 - packages/kbn-interpreter/package.json | 1 - packages/kbn-monaco/package.json | 1 - packages/kbn-optimizer/package.json | 1 - packages/kbn-test/package.json | 1 - packages/kbn-ui-shared-deps/package.json | 1 - x-pack/package.json | 4 +- yarn.lock | 2 +- 17 files changed, 70 insertions(+), 22 deletions(-) create mode 100644 packages/kbn-babel-preset/BUILD.bazel diff --git a/docs/developer/getting-started/monorepo-packages.asciidoc b/docs/developer/getting-started/monorepo-packages.asciidoc index bc47e46f6763b..9564087dabefe 100644 --- a/docs/developer/getting-started/monorepo-packages.asciidoc +++ b/docs/developer/getting-started/monorepo-packages.asciidoc @@ -63,6 +63,7 @@ yarn kbn watch-bazel - @elastic/datemath - @kbn/apm-utils +- @kbn/babel-preset - @kbn/config-schema - @kbn/tinymath - @kbn/utility-types diff --git a/package.json b/package.json index 383acc2bb118f..b65652ec3a296 100644 --- a/package.json +++ b/package.json @@ -451,7 +451,7 @@ "@istanbuljs/schema": "^0.1.2", "@jest/reporters": "^26.5.2", "@kbn/babel-code-parser": "link:packages/kbn-babel-code-parser", - "@kbn/babel-preset": "link:packages/kbn-babel-preset", + "@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", "@kbn/docs-utils": "link:packages/kbn-docs-utils", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index fe0e8efe0d44f..e1a85e926f049 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -5,6 +5,7 @@ filegroup( srcs = [ "//packages/elastic-datemath:build", "//packages/kbn-apm-utils:build", + "//packages/kbn-babel-preset:build", "//packages/kbn-config-schema:build", "//packages/kbn-tinymath:build", "//packages/kbn-utility-types:build", diff --git a/packages/kbn-ace/package.json b/packages/kbn-ace/package.json index 30f37b4786f36..5b4b0312aa1ae 100644 --- a/packages/kbn-ace/package.json +++ b/packages/kbn-ace/package.json @@ -10,7 +10,6 @@ "kbn:bootstrap": "yarn build --dev" }, "devDependencies": { - "@kbn/dev-utils": "link:../kbn-dev-utils", - "@kbn/babel-preset": "link:../kbn-babel-preset" + "@kbn/dev-utils": "link:../kbn-dev-utils" } } \ No newline at end of file diff --git a/packages/kbn-analytics/package.json b/packages/kbn-analytics/package.json index 715f0af96ea3e..5b9db79febd77 100644 --- a/packages/kbn-analytics/package.json +++ b/packages/kbn-analytics/package.json @@ -14,7 +14,6 @@ "kbn:watch": "node scripts/build --source-maps --watch" }, "devDependencies": { - "@kbn/dev-utils": "link:../kbn-dev-utils", - "@kbn/babel-preset": "link:../kbn-babel-preset" + "@kbn/dev-utils": "link:../kbn-dev-utils" } } \ No newline at end of file diff --git a/packages/kbn-babel-code-parser/package.json b/packages/kbn-babel-code-parser/package.json index bfe01c6eae8e3..a5e05da6f8ee4 100755 --- a/packages/kbn-babel-code-parser/package.json +++ b/packages/kbn-babel-code-parser/package.json @@ -13,8 +13,5 @@ "build": "../../node_modules/.bin/babel src --out-dir target", "kbn:bootstrap": "yarn build --quiet", "kbn:watch": "yarn build --watch" - }, - "dependencies": { - "@kbn/babel-preset": "link:../kbn-babel-preset" } } diff --git a/packages/kbn-babel-preset/BUILD.bazel b/packages/kbn-babel-preset/BUILD.bazel new file mode 100644 index 0000000000000..13542ed6e73ad --- /dev/null +++ b/packages/kbn-babel-preset/BUILD.bazel @@ -0,0 +1,63 @@ +load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") + +PKG_BASE_NAME = "kbn-babel-preset" +PKG_REQUIRE_NAME = "@kbn/babel-preset" + +SOURCE_FILES = glob([ + "common_babel_parser_options.js", + "common_preset.js", + "istanbul_preset.js", + "node_preset.js", + "webpack_preset.js", +]) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", + "README.md", +] + +DEPS = [ + "@npm//@babel/plugin-proposal-class-properties", + "@npm//@babel/plugin-proposal-export-namespace-from", + "@npm//@babel/plugin-proposal-nullish-coalescing-operator", + "@npm//@babel/plugin-proposal-optional-chaining", + "@npm//@babel/plugin-proposal-private-methods", + "@npm//@babel/preset-env", + "@npm//@babel/preset-react", + "@npm//@babel/preset-typescript", + "@npm//babel-plugin-add-module-exports", + "@npm//babel-plugin-styled-components", +] + +js_library( + name = PKG_BASE_NAME, + srcs = [ + ":srcs", + ], + deps = DEPS, + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + srcs = NPM_MODULE_EXTRA_FILES, + deps = [ + ":%s" % PKG_BASE_NAME, + ] +) + +filegroup( + name = "build", + srcs = [ + ":npm_module", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-dev-utils/package.json b/packages/kbn-dev-utils/package.json index e1990fca4e0bb..87e142c3bece7 100644 --- a/packages/kbn-dev-utils/package.json +++ b/packages/kbn-dev-utils/package.json @@ -17,7 +17,6 @@ "@kbn/utils": "link:../kbn-utils" }, "devDependencies": { - "@kbn/babel-preset": "link:../kbn-babel-preset", "@kbn/expect": "link:../kbn-expect" } } \ No newline at end of file diff --git a/packages/kbn-es/package.json b/packages/kbn-es/package.json index c8fe2101bd639..f47f042505cad 100644 --- a/packages/kbn-es/package.json +++ b/packages/kbn-es/package.json @@ -14,8 +14,5 @@ }, "dependencies": { "@kbn/dev-utils": "link:../kbn-dev-utils" - }, - "devDependencies": { - "@kbn/babel-preset": "link:../kbn-babel-preset" } } \ No newline at end of file diff --git a/packages/kbn-i18n/package.json b/packages/kbn-i18n/package.json index d3b4e56fe05d4..570110589490b 100644 --- a/packages/kbn-i18n/package.json +++ b/packages/kbn-i18n/package.json @@ -12,7 +12,6 @@ "kbn:watch": "node scripts/build --watch --source-maps" }, "devDependencies": { - "@kbn/babel-preset": "link:../kbn-babel-preset", "@kbn/dev-utils": "link:../kbn-dev-utils" } } \ No newline at end of file diff --git a/packages/kbn-interpreter/package.json b/packages/kbn-interpreter/package.json index 59a14fa828583..491a7205be210 100644 --- a/packages/kbn-interpreter/package.json +++ b/packages/kbn-interpreter/package.json @@ -13,7 +13,6 @@ "@kbn/i18n": "link:../kbn-i18n" }, "devDependencies": { - "@kbn/babel-preset": "link:../kbn-babel-preset", "@kbn/dev-utils": "link:../kbn-dev-utils" } } \ No newline at end of file diff --git a/packages/kbn-monaco/package.json b/packages/kbn-monaco/package.json index bdf36915bab3a..f4309e08f5bdb 100644 --- a/packages/kbn-monaco/package.json +++ b/packages/kbn-monaco/package.json @@ -11,7 +11,6 @@ "build:antlr4ts": "../../node_modules/antlr4ts-cli/antlr4ts ./src/painless/antlr/painless_lexer.g4 ./src/painless/antlr/painless_parser.g4 && node ./scripts/fix_generated_antlr.js" }, "devDependencies": { - "@kbn/babel-preset": "link:../kbn-babel-preset", "@kbn/dev-utils": "link:../kbn-dev-utils" }, "dependencies": { diff --git a/packages/kbn-optimizer/package.json b/packages/kbn-optimizer/package.json index ac73fbc0fc16a..3c14d98755a32 100644 --- a/packages/kbn-optimizer/package.json +++ b/packages/kbn-optimizer/package.json @@ -11,7 +11,6 @@ "kbn:watch": "yarn build --watch" }, "dependencies": { - "@kbn/babel-preset": "link:../kbn-babel-preset", "@kbn/config": "link:../kbn-config", "@kbn/dev-utils": "link:../kbn-dev-utils", "@kbn/std": "link:../kbn-std", diff --git a/packages/kbn-test/package.json b/packages/kbn-test/package.json index a2dc8f84cfb51..2afbe41e0e00e 100644 --- a/packages/kbn-test/package.json +++ b/packages/kbn-test/package.json @@ -19,7 +19,6 @@ "@kbn/optimizer": "link:../kbn-optimizer" }, "devDependencies": { - "@kbn/babel-preset": "link:../kbn-babel-preset", "@kbn/dev-utils": "link:../kbn-dev-utils", "@kbn/expect": "link:../kbn-expect", "@kbn/utils": "link:../kbn-utils" diff --git a/packages/kbn-ui-shared-deps/package.json b/packages/kbn-ui-shared-deps/package.json index 47a2fa19e7a8e..00c6f677cd223 100644 --- a/packages/kbn-ui-shared-deps/package.json +++ b/packages/kbn-ui-shared-deps/package.json @@ -14,7 +14,6 @@ "@kbn/monaco": "link:../kbn-monaco" }, "devDependencies": { - "@kbn/babel-preset": "link:../kbn-babel-preset", "@kbn/dev-utils": "link:../kbn-dev-utils" } } \ No newline at end of file diff --git a/x-pack/package.json b/x-pack/package.json index e8745c4c56e5c..79ceafddff309 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -27,14 +27,12 @@ "yarn": "^1.21.1" }, "devDependencies": { - "@kbn/babel-preset": "link:../packages/kbn-babel-preset", "@kbn/dev-utils": "link:../packages/kbn-dev-utils", "@kbn/es": "link:../packages/kbn-es", "@kbn/expect": "link:../packages/kbn-expect", "@kbn/plugin-helpers": "link:../packages/kbn-plugin-helpers", "@kbn/storybook": "link:../packages/kbn-storybook", - "@kbn/test": "link:../packages/kbn-test", - "@kbn/utility-types": "link:../packages/kbn-utility-types" + "@kbn/test": "link:../packages/kbn-test" }, "dependencies": { "@elastic/safer-lodash-set": "link:../packages/elastic-safer-lodash-set", diff --git a/yarn.lock b/yarn.lock index 3441c07f07971..e691688529553 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2624,7 +2624,7 @@ version "0.0.0" uid "" -"@kbn/babel-preset@link:packages/kbn-babel-preset": +"@kbn/babel-preset@link:bazel-bin/packages/kbn-babel-preset/npm_module": version "0.0.0" uid ""