Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[packages] Move @kbn/legacy-logging to Bazel #98810

Merged
merged 5 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -71,6 +71,7 @@ yarn kbn watch-bazel
- @kbn/config-schema
- @kbn/dev-utils
- @kbn/expect
- @kbn/legacy-logging
- @kbn/logging
- @kbn/std
- @kbn/tinymath
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"@kbn/i18n": "link:packages/kbn-i18n",
"@kbn/interpreter": "link:packages/kbn-interpreter",
"@kbn/io-ts-utils": "link:packages/kbn-io-ts-utils",
"@kbn/legacy-logging": "link:packages/kbn-legacy-logging",
"@kbn/legacy-logging": "link:bazel-bin/packages/kbn-legacy-logging/npm_module",
"@kbn/logging": "link:bazel-bin/packages/kbn-logging/npm_module",
"@kbn/monaco": "link:packages/kbn-monaco",
"@kbn/server-http-tools": "link:packages/kbn-server-http-tools",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ filegroup(
"//packages/kbn-config-schema:build",
"//packages/kbn-dev-utils:build",
"//packages/kbn-expect:build",
"//packages/kbn-legacy-logging:build",
"//packages/kbn-logging:build",
"//packages/kbn-std:build",
"//packages/kbn-tinymath:build",
Expand Down
92 changes: 92 additions & 0 deletions packages/kbn-legacy-logging/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
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-legacy-logging"
PKG_REQUIRE_NAME = "@kbn/legacy-logging"

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

SRCS = SOURCE_FILES

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

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

SRC_DEPS = [
"//packages/kbn-config-schema",
"@npm//@elastic/numeral",
"@npm//@hapi/hapi",
"@npm//chokidar",
"@npm//lodash",
"@npm//moment-timezone",
"@npm//query-string",
"@npm//rxjs",
"@npm//tslib",
]

TYPES_DEPS = [
"@npm//@types/hapi__hapi",
"@npm//@types/hapi__podium",
"@npm//@types/jest",
"@npm//@types/lodash",
"@npm//@types/moment-timezone",
"@npm//@types/node",
]

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"],
)
7 changes: 1 addition & 6 deletions packages/kbn-legacy-logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,5 @@
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js",
"types": "./target/index.d.ts",
"scripts": {
"build": "tsc",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
}
"types": "./target/index.d.ts"
}
11 changes: 3 additions & 8 deletions packages/kbn-legacy-logging/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"incremental": true,
"outDir": "target",
"stripInternal": false,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
mistic marked this conversation as resolved.
Show resolved Hide resolved
"sourceRoot": "../../../../packages/kbn-legacy-logging/src",
"types": [
"jest",
"node"
]
"types": ["jest", "node"]
},
"include": [
"src/**/*"
]
"include": ["src/**/*"]
}
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2663,7 +2663,7 @@
version "0.0.0"
uid ""

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

Expand Down