[packages] Move @kbn/telemetry-tools to Bazel (#99726) (#99929)

Co-authored-by: Jonathan Budzenski <jon@budzenski.me>
This commit is contained in:
Kibana Machine 2021-05-14 12:26:59 -04:00 committed by GitHub
parent a961e9fcee
commit 500e8d8f39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 103 additions and 20 deletions

View file

@ -89,6 +89,7 @@ yarn kbn watch-bazel
- @kbn/securitysolution-io-ts-utils
- @kbn/securitysolution-utils
- @kbn/std
- @kbn/telemetry-utils
- @kbn/tinymath
- @kbn/utility-types
- @kbn/utils

View file

@ -459,7 +459,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",

View file

@ -32,6 +32,7 @@ filegroup(
"//packages/kbn-securitysolution-utils:build",
"//packages/kbn-securitysolution-es-utils:build",
"//packages/kbn-std:build",
"//packages/kbn-telemetry-tools:build",
"//packages/kbn-tinymath:build",
"//packages/kbn-utility-types:build",
"//packages/kbn-utils:build",

View file

@ -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"],
)

View file

@ -1,12 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
module.exports = {
presets: ['@kbn/babel-preset/node_preset'],
ignore: ['**/*.test.ts', '**/__fixture__/**'],
};

View file

@ -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"
}
}

View file

@ -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

View file

@ -2743,7 +2743,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 ""