Skip to content

Commit

Permalink
chore(NA): chore(NA): moving @kbn/utils into bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic committed Apr 21, 2021
1 parent 6532478 commit 119ceac
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 29 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 @@ -67,4 +67,5 @@ yarn kbn watch-bazel
- @kbn/config-schema
- @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 @@ -142,7 +142,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 @@ -9,5 +9,6 @@ filegroup(
"//packages/kbn-config-schema: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 @@ -19,7 +19,6 @@
"@kbn/server-http-tools": "link:../kbn-server-http-tools",
"@kbn/optimizer": "link:../kbn-optimizer",
"@kbn/std": "link:../kbn-std",
"@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"
}
}
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 @@ -2762,7 +2762,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 119ceac

Please sign in to comment.