Skip to content

Commit

Permalink
chore(NA): moving @kbn/server-http-tools into bazel (elastic#100153)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic authored and kibanamachine committed May 14, 2021
1 parent 58d35cc commit d08d557
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 13 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 @@ -88,6 +88,7 @@ yarn kbn watch-bazel
- kbn/securitysolution-io-ts-types
- @kbn/securitysolution-io-ts-utils
- @kbn/securitysolution-utils
- @kbn/server-http-tools
- @kbn/std
- @kbn/telemetry-utils
- @kbn/tinymath
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"@kbn/securitysolution-io-ts-list-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-list-types/npm_module",
"@kbn/securitysolution-io-ts-utils": "link:bazel-bin/packages/kbn-securitysolution-io-ts-utils/npm_module",
"@kbn/securitysolution-utils": "link:bazel-bin/packages/kbn-securitysolution-utils/npm_module",
"@kbn/server-http-tools": "link:packages/kbn-server-http-tools",
"@kbn/server-http-tools": "link:bazel-bin/packages/kbn-server-http-tools/npm_module",
"@kbn/server-route-repository": "link:packages/kbn-server-route-repository",
"@kbn/std": "link:bazel-bin/packages/kbn-std/npm_module",
"@kbn/tinymath": "link:bazel-bin/packages/kbn-tinymath/npm_module",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ filegroup(
"//packages/kbn-securitysolution-io-ts-utils:build",
"//packages/kbn-securitysolution-utils:build",
"//packages/kbn-securitysolution-es-utils:build",
"//packages/kbn-server-http-tools:build",
"//packages/kbn-std:build",
"//packages/kbn-telemetry-tools:build",
"//packages/kbn-tinymath:build",
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-cli-dev-mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"devOnly": true
},
"dependencies": {
"@kbn/server-http-tools": "link:../kbn-server-http-tools",
"@kbn/optimizer": "link:../kbn-optimizer"
}
}
90 changes: 90 additions & 0 deletions packages/kbn-server-http-tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
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-server-http-tools"
PKG_REQUIRE_NAME = "@kbn/server-http-tools"

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",
"//packages/kbn-crypto",
"@npm//@hapi/hapi",
"@npm//@hapi/hoek",
"@npm//joi",
"@npm//moment",
"@npm//uuid",
]

TYPES_DEPS = [
"@npm//@types/hapi__hapi",
"@npm//@types/joi",
"@npm//@types/node",
"@npm//@types/uuid",
]

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"],
)
10 changes: 1 addition & 9 deletions packages/kbn-server-http-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,5 @@
"types": "./target/index.d.ts",
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true,
"scripts": {
"build": "rm -rf target && ../../node_modules/.bin/tsc",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"devDependencies": {
"@kbn/utility-types": "link:../kbn-utility-types"
}
"private": true
}
3 changes: 2 additions & 1 deletion packages/kbn-server-http-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-server-http-tools/src"
},
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2727,7 +2727,7 @@
version "0.0.0"
uid ""

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

Expand Down

0 comments on commit d08d557

Please sign in to comment.