Skip to content

Commit

Permalink
[packages] Move @kbn/legacy-logging to Bazel (#98810)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz authored Apr 30, 2021
1 parent 93ed44d commit 3d8f1b1
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 16 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 @@ -72,6 +72,7 @@ yarn kbn watch-bazel
- @kbn/dev-utils
- @kbn/eslint-import-resolver-kibana
- @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 @@ -14,6 +14,7 @@ filegroup(
"//packages/kbn-dev-utils:build",
"//packages/kbn-eslint-import-resolver-kibana: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"
}
12 changes: 4 additions & 8 deletions packages/kbn-legacy-logging/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"incremental": true,
"outDir": "target",
"stripInternal": false,
"declaration": true,
"declarationMap": true,
"rootDir": "src",
"sourceMap": true,
"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

0 comments on commit 3d8f1b1

Please sign in to comment.