From ebe1f7c95d6bab007deb948912206e032f23bc71 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 28 Jun 2021 13:08:28 -0400 Subject: [PATCH] chore(NA): moving @kbn/spec-to-console into bazel (#103470) (#103498) * chore(NA): moving @kbn/spec-to-console into bazel * chore(NA): fix licenses Co-authored-by: Tiago Costa --- .../monorepo-packages.asciidoc | 1 + package.json | 1 + packages/BUILD.bazel | 1 + packages/kbn-spec-to-console/BUILD.bazel | 55 +++++++++++++++++++ .../cluster_health_autocomplete.json | 0 .../__fixtures__}/cluster_health_spec.json | 0 .../kbn-spec-to-console/lib/convert.test.js | 4 +- packages/kbn-spec-to-console/package.json | 5 +- scripts/spec_to_console.js | 2 +- yarn.lock | 4 ++ 10 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 packages/kbn-spec-to-console/BUILD.bazel rename packages/kbn-spec-to-console/{test/fixtures => lib/__fixtures__}/cluster_health_autocomplete.json (100%) rename packages/kbn-spec-to-console/{test/fixtures => lib/__fixtures__}/cluster_health_spec.json (100%) diff --git a/docs/developer/getting-started/monorepo-packages.asciidoc b/docs/developer/getting-started/monorepo-packages.asciidoc index 217645b903818..0ee4c09192896 100644 --- a/docs/developer/getting-started/monorepo-packages.asciidoc +++ b/docs/developer/getting-started/monorepo-packages.asciidoc @@ -103,6 +103,7 @@ yarn kbn watch-bazel - @kbn/securitysolution-utils - @kbn/server-http-tools - @kbn/server-route-repository +- @kbn/spec-to-console - @kbn/std - @kbn/storybook - @kbn/telemetry-utils diff --git a/package.json b/package.json index 2f23624ab1410..378e6b22782c6 100644 --- a/package.json +++ b/package.json @@ -467,6 +467,7 @@ "@kbn/plugin-generator": "link:bazel-bin/packages/kbn-plugin-generator", "@kbn/plugin-helpers": "link:bazel-bin/packages/kbn-plugin-helpers", "@kbn/pm": "link:packages/kbn-pm", + "@kbn/spec-to-console": "link:bazel-bin/packages/kbn-spec-to-console", "@kbn/storybook": "link:bazel-bin/packages/kbn-storybook", "@kbn/telemetry-tools": "link:bazel-bin/packages/kbn-telemetry-tools", "@kbn/test": "link:packages/kbn-test", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 1094a2def3e70..225a41a5fd8b6 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -48,6 +48,7 @@ filegroup( "//packages/kbn-securitysolution-hook-utils:build", "//packages/kbn-server-http-tools:build", "//packages/kbn-server-route-repository:build", + "//packages/kbn-spec-to-console:build", "//packages/kbn-std:build", "//packages/kbn-storybook:build", "//packages/kbn-telemetry-tools:build", diff --git a/packages/kbn-spec-to-console/BUILD.bazel b/packages/kbn-spec-to-console/BUILD.bazel new file mode 100644 index 0000000000000..8a083be9fce91 --- /dev/null +++ b/packages/kbn-spec-to-console/BUILD.bazel @@ -0,0 +1,55 @@ +load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") + +PKG_BASE_NAME = "kbn-spec-to-console" +PKG_REQUIRE_NAME = "@kbn/spec-to-console" + +SOURCE_FILES = glob( + [ + "bin/**/*", + "lib/**/*", + "index.js" + ], + exclude = [ + "**/*.test.*", + "**/__fixtures__/**", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", + "README.md", +] + +DEPS = [] + +js_library( + name = PKG_BASE_NAME, + srcs = NPM_MODULE_EXTRA_FILES + [ + ":srcs", + ], + deps = 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"], +) diff --git a/packages/kbn-spec-to-console/test/fixtures/cluster_health_autocomplete.json b/packages/kbn-spec-to-console/lib/__fixtures__/cluster_health_autocomplete.json similarity index 100% rename from packages/kbn-spec-to-console/test/fixtures/cluster_health_autocomplete.json rename to packages/kbn-spec-to-console/lib/__fixtures__/cluster_health_autocomplete.json diff --git a/packages/kbn-spec-to-console/test/fixtures/cluster_health_spec.json b/packages/kbn-spec-to-console/lib/__fixtures__/cluster_health_spec.json similarity index 100% rename from packages/kbn-spec-to-console/test/fixtures/cluster_health_spec.json rename to packages/kbn-spec-to-console/lib/__fixtures__/cluster_health_spec.json diff --git a/packages/kbn-spec-to-console/lib/convert.test.js b/packages/kbn-spec-to-console/lib/convert.test.js index 6d6b6ba364d38..14cb2dd7b6c04 100644 --- a/packages/kbn-spec-to-console/lib/convert.test.js +++ b/packages/kbn-spec-to-console/lib/convert.test.js @@ -8,8 +8,8 @@ const convert = require('./convert'); -const clusterHealthSpec = require('../test/fixtures/cluster_health_spec'); -const clusterHealthAutocomplete = require('../test/fixtures/cluster_health_autocomplete'); +const clusterHealthSpec = require('./__fixtures__/cluster_health_spec'); +const clusterHealthAutocomplete = require('./__fixtures__/cluster_health_autocomplete'); test('convert', () => { expect(convert(clusterHealthSpec)).toEqual(clusterHealthAutocomplete); diff --git a/packages/kbn-spec-to-console/package.json b/packages/kbn-spec-to-console/package.json index c6cf8cf9ec46d..b4e488db7f4d9 100644 --- a/packages/kbn-spec-to-console/package.json +++ b/packages/kbn-spec-to-console/package.json @@ -1,11 +1,12 @@ { - "name": "spec-to-console", - "version": "0.0.0", + "name": "@kbn/spec-to-console", + "version": "1.0.0", "description": "ES REST spec -> Console autocomplete", "main": "index.js", "directories": { "lib": "lib" }, + "private": true, "scripts": { "format": "../../node_modules/.bin/prettier **/*.js --write" }, diff --git a/scripts/spec_to_console.js b/scripts/spec_to_console.js index cbb152f55f8fb..37e246323a11f 100644 --- a/scripts/spec_to_console.js +++ b/scripts/spec_to_console.js @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -require('../packages/kbn-spec-to-console/bin/spec_to_console'); +require('@kbn/spec-to-console/bin/spec_to_console'); diff --git a/yarn.lock b/yarn.lock index 59c72fcb4f6cd..945ba8b270c7b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2769,6 +2769,10 @@ version "0.0.0" uid "" +"@kbn/spec-to-console@link:bazel-bin/packages/kbn-spec-to-console": + version "0.0.0" + uid "" + "@kbn/std@link:bazel-bin/packages/kbn-std": version "0.0.0" uid ""