Skip to content

Commit 64528b1

Browse files
chore(NA): moving @kbn/io-ts-utils into bazel (#100810) (#100893)
Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
1 parent 41ef9ec commit 64528b1

File tree

8 files changed

+91
-12
lines changed

8 files changed

+91
-12
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ yarn kbn watch-bazel
8080
- @kbn/eslint-plugin-eslint
8181
- @kbn/expect
8282
- @kbn/i18n
83+
- @kbn/io-ts-utils
8384
- @kbn/legacy-logging
8485
- @kbn/logging
8586
- @kbn/mapbox-gl

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
"@kbn/mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl/npm_module",
131131
"@kbn/i18n": "link:bazel-bin/packages/kbn-i18n/npm_module",
132132
"@kbn/interpreter": "link:packages/kbn-interpreter",
133-
"@kbn/io-ts-utils": "link:packages/kbn-io-ts-utils",
133+
"@kbn/io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils/npm_module",
134134
"@kbn/legacy-logging": "link:bazel-bin/packages/kbn-legacy-logging/npm_module",
135135
"@kbn/logging": "link:bazel-bin/packages/kbn-logging/npm_module",
136136
"@kbn/monaco": "link:bazel-bin/packages/kbn-monaco/npm_module",

packages/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ filegroup(
2222
"//packages/kbn-eslint-plugin-eslint:build",
2323
"//packages/kbn-expect:build",
2424
"//packages/kbn-i18n:build",
25+
"//packages/kbn-io-ts-utils:build",
2526
"//packages/kbn-legacy-logging:build",
2627
"//packages/kbn-logging:build",
2728
"//packages/kbn-mapbox-gl:build",
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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-io-ts-utils"
5+
PKG_REQUIRE_NAME = "@kbn/io-ts-utils"
6+
7+
SOURCE_FILES = glob(
8+
[
9+
"src/**/*.ts",
10+
],
11+
exclude = [
12+
"**/*.test.*"
13+
],
14+
)
15+
16+
SRCS = SOURCE_FILES
17+
18+
filegroup(
19+
name = "srcs",
20+
srcs = SRCS,
21+
)
22+
23+
NPM_MODULE_EXTRA_FILES = [
24+
"package.json",
25+
]
26+
27+
SRC_DEPS = [
28+
"@npm//fp-ts",
29+
"@npm//io-ts",
30+
"@npm//lodash",
31+
"@npm//tslib",
32+
]
33+
34+
TYPES_DEPS = [
35+
"@npm//@types/jest",
36+
"@npm//@types/lodash",
37+
"@npm//@types/node",
38+
]
39+
40+
DEPS = SRC_DEPS + TYPES_DEPS
41+
42+
ts_config(
43+
name = "tsconfig",
44+
src = "tsconfig.json",
45+
deps = [
46+
"//:tsconfig.base.json",
47+
],
48+
)
49+
50+
ts_project(
51+
name = "tsc",
52+
args = ['--pretty'],
53+
srcs = SRCS,
54+
deps = DEPS,
55+
declaration = True,
56+
declaration_map = True,
57+
incremental = True,
58+
out_dir = "target",
59+
source_map = True,
60+
root_dir = "src",
61+
tsconfig = ":tsconfig",
62+
)
63+
64+
js_library(
65+
name = PKG_BASE_NAME,
66+
srcs = NPM_MODULE_EXTRA_FILES,
67+
deps = DEPS + [":tsc"],
68+
package_name = PKG_REQUIRE_NAME,
69+
visibility = ["//visibility:public"],
70+
)
71+
72+
pkg_npm(
73+
name = "npm_module",
74+
deps = [
75+
":%s" % PKG_BASE_NAME,
76+
]
77+
)
78+
79+
filegroup(
80+
name = "build",
81+
srcs = [
82+
":npm_module",
83+
],
84+
visibility = ["//visibility:public"],
85+
)

packages/kbn-io-ts-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-io-ts-utils/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4-
"incremental": false,
4+
"incremental": true,
55
"outDir": "./target",
66
"stripInternal": false,
77
"declaration": true,

packages/kbn-server-route-repository/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,5 @@
99
"build": "../../node_modules/.bin/tsc",
1010
"kbn:bootstrap": "yarn build",
1111
"kbn:watch": "yarn build --watch"
12-
},
13-
"dependencies": {
14-
"@kbn/io-ts-utils": "link:../kbn-io-ts-utils"
1512
}
1613
}

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2666,7 +2666,7 @@
26662666
version "0.0.0"
26672667
uid ""
26682668

2669-
"@kbn/io-ts-utils@link:packages/kbn-io-ts-utils":
2669+
"@kbn/io-ts-utils@link:bazel-bin/packages/kbn-io-ts-utils/npm_module":
26702670
version "0.0.0"
26712671
uid ""
26722672

0 commit comments

Comments
 (0)