Skip to content

Commit

Permalink
chore(NA): moving @kbn/config into bazel (#99199)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic authored May 4, 2021
1 parent 08d7e1c commit d6b41ff
Show file tree
Hide file tree
Showing 10 changed files with 103 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 @@ -69,6 +69,7 @@ yarn kbn watch-bazel
- @kbn/apm-utils
- @kbn/babel-code-parser
- @kbn/babel-preset
- @kbn/config
- @kbn/config-schema
- @kbn/dev-utils
- @kbn/eslint-import-resolver-kibana
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"@kbn/analytics": "link:bazel-bin/packages/kbn-analytics/npm_module",
"@kbn/apm-config-loader": "link:bazel-bin/packages/kbn-apm-config-loader/npm_module",
"@kbn/apm-utils": "link:bazel-bin/packages/kbn-apm-utils/npm_module",
"@kbn/config": "link:packages/kbn-config",
"@kbn/config": "link:bazel-bin/packages/kbn-config/npm_module",
"@kbn/config-schema": "link:bazel-bin/packages/kbn-config-schema/npm_module",
"@kbn/crypto": "link:packages/kbn-crypto",
"@kbn/i18n": "link:packages/kbn-i18n",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ filegroup(
"//packages/kbn-apm-utils:build",
"//packages/kbn-babel-code-parser:build",
"//packages/kbn-babel-preset:build",
"//packages/kbn-config:build",
"//packages/kbn-config-schema:build",
"//packages/kbn-dev-utils:build",
"//packages/kbn-eslint-import-resolver-kibana: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/config": "link:../kbn-config",
"@kbn/server-http-tools": "link:../kbn-server-http-tools",
"@kbn/optimizer": "link:../kbn-optimizer"
}
Expand Down
97 changes: 97 additions & 0 deletions packages/kbn-config/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
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-config"
PKG_REQUIRE_NAME = "@kbn/config"

SOURCE_FILES = glob(
[
"src/**/*.ts",
],
exclude = [
"**/*.test.*",
"**/__fixtures__",
"**/__mocks__",
"**/__snapshots__"
],
)

SRCS = SOURCE_FILES

filegroup(
name = "srcs",
srcs = SRCS,
)

NPM_MODULE_EXTRA_FILES = [
"package.json",
"README.md"
]

SRC_DEPS = [
"//packages/elastic-safer-lodash-set",
"//packages/kbn-config-schema",
"//packages/kbn-logging",
"//packages/kbn-std",
"//packages/kbn-utility-types",
"@npm//js-yaml",
"@npm//load-json-file",
"@npm//lodash",
"@npm//rxjs",
"@npm//type-detect",
]

TYPES_DEPS = [
"@npm//@types/jest",
"@npm//@types/js-yaml",
"@npm//@types/lodash",
"@npm//@types/node",
"@npm//@types/type-detect",
]

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"],
)
6 changes: 1 addition & 5 deletions packages/kbn-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@
"types": "./target/index.d.ts",
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true,
"scripts": {
"build": "../../node_modules/.bin/tsc",
"kbn:bootstrap": "yarn build"
}
"private": true
}
2 changes: 1 addition & 1 deletion packages/kbn-config/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",
"stripInternal": false,
"declaration": true,
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-docs-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@
"scripts": {
"kbn:bootstrap": "../../node_modules/.bin/tsc",
"kbn:watch": "../../node_modules/.bin/tsc --watch"
},
"dependencies": {
"@kbn/config": "link:../kbn-config"
}
}
1 change: 0 additions & 1 deletion packages/kbn-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"kbn:watch": "yarn build --watch"
},
"dependencies": {
"@kbn/config": "link:../kbn-config",
"@kbn/ui-shared-deps": "link:../kbn-ui-shared-deps"
}
}
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,7 @@
version "0.0.0"
uid ""

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

Expand Down

0 comments on commit d6b41ff

Please sign in to comment.