Skip to content

Commit

Permalink
[packages] Move @kbn/telemetry-tools to Bazel (#99726)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz committed May 12, 2021
1 parent a900110 commit 6759578
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 20 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 @@ -84,6 +84,7 @@ yarn kbn watch-bazel
- @kbn/securitysolution-utils
- @kbn/securitysolution-io-ts-utils
- @kbn/std
- @kbn/telemetry-utils
- @kbn/tinymath
- @kbn/utility-types
- @kbn/utils
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@
"@kbn/plugin-helpers": "link:packages/kbn-plugin-helpers",
"@kbn/pm": "link:packages/kbn-pm",
"@kbn/storybook": "link:packages/kbn-storybook",
"@kbn/telemetry-tools": "link:packages/kbn-telemetry-tools",
"@kbn/telemetry-tools": "link:bazel-bin/packages/kbn-telemetry-tools/npm_module",
"@kbn/test": "link:packages/kbn-test",
"@kbn/test-subj-selector": "link:packages/kbn-test-subj-selector",
"@loaders.gl/polyfills": "^2.3.5",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ filegroup(
"//packages/kbn-securitysolution-io-ts-utils:build",
"//packages/kbn-securitysolution-utils:build",
"//packages/kbn-std:build",
"//packages/kbn-telemetry-tools:build",
"//packages/kbn-tinymath:build",
"//packages/kbn-utility-types:build",
"//packages/kbn-utils:build",
Expand Down
97 changes: 97 additions & 0 deletions packages/kbn-telemetry-tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")

PKG_BASE_NAME = "kbn-telemetry-tools"
PKG_REQUIRE_NAME = "@kbn/telemetry-tools"

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

SRCS = SOURCE_FILES

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

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

SRC_DEPS = [
"//packages/kbn-dev-utils",
"//packages/kbn-utility-types",
"@npm//glob",
"@npm//jest-styled-components",
"@npm//listr",
"@npm//normalize-path",
"@npm//tslib",
]

TYPES_DEPS = [
"@npm//@types/flot",
"@npm//@types/glob",
"@npm//@types/jest",
"@npm//@types/listr",
"@npm//@types/lodash",
"@npm//@types/node",
"@npm//@types/normalize-path",
"@npm//@types/testing-library__jest-dom",
]

DEPS = SRC_DEPS + TYPES_DEPS

ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
],
)

ts_project(
name = "tsc",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
declaration = True,
declaration_map = True,
incremental = True,
out_dir = "target",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig",
)

js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = [":tsc"] + 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"],
)
12 changes: 0 additions & 12 deletions packages/kbn-telemetry-tools/babel.config.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/kbn-telemetry-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,5 @@
"private": true,
"kibana": {
"devOnly": true
},
"scripts": {
"build": "../../node_modules/.bin/babel src --out-dir target --delete-dir-on-start --extensions .ts --source-maps=inline",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
}
}
3 changes: 2 additions & 1 deletion packages/kbn-telemetry-tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"incremental": true,
"outDir": "./target",
"declaration": true,
"declarationMap": true,
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-telemetry-tools/src",
"isolatedModules": true
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2726,7 +2726,7 @@
version "0.0.0"
uid ""

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

Expand Down

0 comments on commit 6759578

Please sign in to comment.