Skip to content

Commit c7f4613

Browse files
chore(NA): moving @kbn/apm-utils into bazel (#96227) (#97024)
* chore(NA): moving @kbn/apm-utils into bazel * chore(NA): add kbn/apm-utils into package.json * chore(NA): missing standard on build file globs * chore(NA): be more explicit about incremental setting * chore(NA): include pretty in the args for ts_project rule * docs(NA): include package migration completion in the developer getting started Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
1 parent 3279e7f commit c7f4613

File tree

9 files changed

+89
-15
lines changed

9 files changed

+89
-15
lines changed

docs/developer/getting-started/monorepo-packages.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ yarn kbn watch-bazel
6262
=== List of Already Migrated Packages to Bazel
6363

6464
- @elastic/datemath
65+
- @kbn/apm-utils
6566

6667

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"@kbn/ace": "link:packages/kbn-ace",
123123
"@kbn/analytics": "link:packages/kbn-analytics",
124124
"@kbn/apm-config-loader": "link:packages/kbn-apm-config-loader",
125-
"@kbn/apm-utils": "link:packages/kbn-apm-utils",
125+
"@kbn/apm-utils": "link:bazel-bin/packages/kbn-apm-utils/npm_module",
126126
"@kbn/config": "link:packages/kbn-config",
127127
"@kbn/config-schema": "link:packages/kbn-config-schema",
128128
"@kbn/crypto": "link:packages/kbn-crypto",

packages/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
filegroup(
44
name = "build",
55
srcs = [
6-
"//packages/elastic-datemath:build"
6+
"//packages/elastic-datemath:build",
7+
"//packages/kbn-apm-utils:build"
78
],
89
)

packages/elastic-datemath/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
44
PKG_BASE_NAME = "elastic-datemath"
55
PKG_REQUIRE_NAME = "@elastic/datemath"
66

7-
SOURCE_FILES = [
7+
SOURCE_FILES = glob([
88
"src/index.ts",
9-
]
9+
])
1010

1111
SRCS = SOURCE_FILES
1212

1313
filegroup(
1414
name = "srcs",
15-
srcs = glob(SOURCE_FILES),
15+
srcs = SRCS,
1616
)
1717

1818
NPM_MODULE_EXTRA_FILES = [

packages/elastic-datemath/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"compilerOptions": {
44
"declaration": true,
55
"declarationMap": true,
6+
"incremental": true,
67
"outDir": "target",
78
"rootDir": "src",
89
"sourceMap": true,

packages/kbn-apm-utils/BUILD.bazel

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
2+
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
3+
4+
PKG_BASE_NAME = "kbn-apm-utils"
5+
PKG_REQUIRE_NAME = "@kbn/apm-utils"
6+
7+
SOURCE_FILES = glob([
8+
"src/index.ts",
9+
])
10+
11+
SRCS = SOURCE_FILES
12+
13+
filegroup(
14+
name = "srcs",
15+
srcs = SRCS,
16+
)
17+
18+
NPM_MODULE_EXTRA_FILES = [
19+
"package.json",
20+
]
21+
22+
SRC_DEPS = [
23+
"@npm//elastic-apm-node",
24+
]
25+
26+
TYPES_DEPS = [
27+
"@npm//@types/node",
28+
]
29+
30+
DEPS = SRC_DEPS + TYPES_DEPS
31+
32+
ts_config(
33+
name = "tsconfig",
34+
src = "tsconfig.json",
35+
deps = [
36+
"//:tsconfig.base.json",
37+
],
38+
)
39+
40+
ts_project(
41+
name = "tsc",
42+
args = ['--pretty'],
43+
srcs = SRCS,
44+
deps = DEPS,
45+
declaration = True,
46+
declaration_map = True,
47+
incremental = True,
48+
out_dir = "target",
49+
source_map = True,
50+
root_dir = "src",
51+
tsconfig = ":tsconfig",
52+
)
53+
54+
js_library(
55+
name = PKG_BASE_NAME,
56+
srcs = [],
57+
deps = [":tsc"] + DEPS,
58+
package_name = PKG_REQUIRE_NAME,
59+
visibility = ["//visibility:public"],
60+
)
61+
62+
pkg_npm(
63+
name = "npm_module",
64+
srcs = NPM_MODULE_EXTRA_FILES,
65+
deps = [
66+
":%s" % PKG_BASE_NAME,
67+
]
68+
)
69+
70+
filegroup(
71+
name = "build",
72+
srcs = [
73+
":npm_module",
74+
],
75+
visibility = ["//visibility:public"],
76+
)

packages/kbn-apm-utils/package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,5 @@
44
"types": "./target/index.d.ts",
55
"version": "1.0.0",
66
"license": "SSPL-1.0 OR Elastic License 2.0",
7-
"private": true,
8-
"scripts": {
9-
"build": "../../node_modules/.bin/tsc",
10-
"kbn:bootstrap": "yarn build",
11-
"kbn:watch": "yarn build --watch"
12-
}
7+
"private": true
138
}

packages/kbn-apm-utils/tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4-
"incremental": false,
5-
"outDir": "./target",
6-
"stripInternal": false,
74
"declaration": true,
85
"declarationMap": true,
6+
"incremental": true,
7+
"outDir": "target",
8+
"rootDir": "src",
99
"sourceMap": true,
1010
"sourceRoot": "../../../../packages/kbn-apm-utils/src",
1111
"types": [

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2616,7 +2616,7 @@
26162616
version "0.0.0"
26172617
uid ""
26182618

2619-
"@kbn/apm-utils@link:packages/kbn-apm-utils":
2619+
"@kbn/apm-utils@link:bazel-bin/packages/kbn-apm-utils/npm_module":
26202620
version "0.0.0"
26212621
uid ""
26222622

0 commit comments

Comments
 (0)