Skip to content

Commit

Permalink
chore(NA): chore(NA): moving @kbn/utils into bazel (#97833) (#98056)
Browse files Browse the repository at this point in the history
* chore(NA): chore(NA): moving @kbn/utils into bazel

* chore(NA): run kbn-test integration test with preserve-symlinks

Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
  • Loading branch information
kibanamachine and mistic authored Apr 22, 2021
1 parent 8f02dd0 commit 673c0c6
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 31 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 @@ -68,4 +68,5 @@ yarn kbn watch-bazel
- @kbn/std
- @kbn/tinymath
- @kbn/utility-types
- @kbn/utils

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"@kbn/ui-framework": "link:packages/kbn-ui-framework",
"@kbn/ui-shared-deps": "link:packages/kbn-ui-shared-deps",
"@kbn/utility-types": "link:bazel-bin/packages/kbn-utility-types/npm_module",
"@kbn/utils": "link:packages/kbn-utils",
"@kbn/utils": "link:bazel-bin/packages/kbn-utils/npm_module",
"@loaders.gl/core": "^2.3.1",
"@loaders.gl/json": "^2.3.1",
"@mapbox/geojson-rewind": "^0.5.0",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ filegroup(
"//packages/kbn-std:build",
"//packages/kbn-tinymath:build",
"//packages/kbn-utility-types:build",
"//packages/kbn-utils:build",
],
)
3 changes: 1 addition & 2 deletions packages/kbn-apm-config-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"kbn:watch": "yarn build --watch"
},
"dependencies": {
"@elastic/safer-lodash-set": "link:../elastic-safer-lodash-set",
"@kbn/utils": "link:../kbn-utils"
"@elastic/safer-lodash-set": "link:../elastic-safer-lodash-set"
}
}
3 changes: 1 addition & 2 deletions packages/kbn-cli-dev-mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"@kbn/logging": "link:../kbn-logging",
"@kbn/server-http-tools": "link:../kbn-server-http-tools",
"@kbn/optimizer": "link:../kbn-optimizer",
"@kbn/dev-utils": "link:../kbn-dev-utils",
"@kbn/utils": "link:../kbn-utils"
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
3 changes: 1 addition & 2 deletions packages/kbn-config-schema/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ ts_project(

js_library(
name = PKG_BASE_NAME,
srcs = [],
srcs = NPM_MODULE_EXTRA_FILES,
deps = [":tsc"] + DEPS,
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)

pkg_npm(
name = "npm_module",
srcs = NPM_MODULE_EXTRA_FILES,
deps = [
":%s" % PKG_BASE_NAME,
]
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
"kibana": {
"devOnly": true
},
"dependencies": {
"@kbn/utils": "link:../kbn-utils"
},
"devDependencies": {
"@kbn/expect": "link:../kbn-expect"
}
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-docs-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"kbn:watch": "../../node_modules/.bin/tsc --watch"
},
"dependencies": {
"@kbn/utils": "link:../kbn-utils",
"@kbn/config": "link:../kbn-config",
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
Expand Down
3 changes: 1 addition & 2 deletions packages/kbn-es-archiver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
},
"dependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils",
"@kbn/test": "link:../kbn-test",
"@kbn/utils": "link:../kbn-utils"
"@kbn/test": "link:../kbn-test"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-legacy-logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@
"build": "tsc",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"dependencies": {
"@kbn/utils": "link:../kbn-utils"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-pm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
},
"dependencies": {
"@kbn/utils": "link:../kbn-utils"
}
}
3 changes: 1 addition & 2 deletions packages/kbn-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils",
"@kbn/expect": "link:../kbn-expect",
"@kbn/utils": "link:../kbn-utils"
"@kbn/expect": "link:../kbn-expect"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ it(
'produces a valid junit report for failures',
async () => {
const result = await execa(
'./node_modules/.bin/jest',
['--config', 'packages/kbn-test/src/jest/integration_tests/__fixtures__/jest.config.js'],
'node',
[
'--preserve-symlinks',
'./node_modules/.bin/jest',
'--config',
'packages/kbn-test/src/jest/integration_tests/__fixtures__/jest.config.js',
],
{
cwd: REPO_ROOT,
env: {
Expand Down
82 changes: 82 additions & 0 deletions packages/kbn-utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
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-utils"
PKG_REQUIRE_NAME = "@kbn/utils"

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//load-json-file",
"@npm//tslib",
]

TYPES_DEPS = [
"@npm//@types/jest",
"@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-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +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"
}
"private": true
}
2 changes: 1 addition & 1 deletion packages/kbn-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"incremental": true,
"outDir": "target",
"declaration": true,
"declarationMap": true,
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2721,7 +2721,7 @@
version "0.0.0"
uid ""

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

Expand Down

0 comments on commit 673c0c6

Please sign in to comment.