Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(NA): moving @kbn/config-schema into bazel #96273

Merged
merged 14 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/developer/getting-started/monorepo-packages.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ yarn kbn watch-bazel

- @elastic/datemath
- @kbn/apm-utils

- @kbn/config-schema

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"@kbn/apm-config-loader": "link:packages/kbn-apm-config-loader",
"@kbn/apm-utils": "link:bazel-bin/packages/kbn-apm-utils/npm_module",
"@kbn/config": "link:packages/kbn-config",
"@kbn/config-schema": "link:packages/kbn-config-schema",
"@kbn/config-schema": "link:bazel-bin/packages/kbn-config-schema/npm_module",
"@kbn/crypto": "link:packages/kbn-crypto",
"@kbn/i18n": "link:packages/kbn-i18n",
"@kbn/interpreter": "link:packages/kbn-interpreter",
Expand Down
3 changes: 2 additions & 1 deletion packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ filegroup(
name = "build",
srcs = [
"//packages/elastic-datemath:build",
"//packages/kbn-apm-utils:build"
"//packages/kbn-apm-utils:build",
"//packages/kbn-config-schema:build"
],
)
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 @@ -15,7 +15,6 @@
},
"dependencies": {
"@kbn/config": "link:../kbn-config",
"@kbn/config-schema": "link:../kbn-config-schema",
mistic marked this conversation as resolved.
Show resolved Hide resolved
"@kbn/logging": "link:../kbn-logging",
"@kbn/server-http-tools": "link:../kbn-server-http-tools",
"@kbn/optimizer": "link:../kbn-optimizer",
Expand Down
86 changes: 86 additions & 0 deletions packages/kbn-config-schema/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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-schema"
PKG_REQUIRE_NAME = "@kbn/config-schema"

SOURCE_FILES = glob([
"src/**/*.ts",
"types/joi.d.ts"
])

SRCS = SOURCE_FILES

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

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

SRC_DEPS = [
"@npm//joi",
"@npm//lodash",
"@npm//moment",
"@npm//tsd",
"@npm//type-detect",
]

TYPES_DEPS = [
"@npm//@types/jest",
"@npm//@types/joi",
"@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 = [],
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,
]
)

filegroup(
name = "build",
srcs = [
":npm_module",
],
visibility = ["//visibility:public"],
)
10 changes: 3 additions & 7 deletions packages/kbn-config-schema/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
"name": "@kbn/config-schema",
"main": "./target/out/index.js",
"types": "./target/types/index.d.ts",
"main": "./target/index.js",
"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
}
8 changes: 4 additions & 4 deletions packages/kbn-config-schema/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"outDir": "./target/out",
"declarationDir": "./target/types",
"stripInternal": true,
"declaration": true,
"declarationMap": true,
"incremental": true,
"outDir": "target",
mistic marked this conversation as resolved.
Show resolved Hide resolved
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../../packages/kbn-config-schema/src",
"stripInternal": true,
"types": [
"jest",
"node"
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
},
"dependencies": {
"@elastic/safer-lodash-set": "link:../elastic-safer-lodash-set",
"@kbn/config-schema": "link:../kbn-config-schema",
"@kbn/logging": "link:../kbn-logging",
"@kbn/std": "link:../kbn-std"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/kbn-legacy-logging/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/utils": "link:../kbn-utils",
"@kbn/config-schema": "link:../kbn-config-schema"
"@kbn/utils": "link:../kbn-utils"
}
}
1 change: 0 additions & 1 deletion packages/kbn-server-http-tools/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-schema": "link:../kbn-config-schema",
"@kbn/crypto": "link:../kbn-crypto",
"@kbn/std": "link:../kbn-std"
},
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@
"build": "rm -rf target && ../../node_modules/.bin/tsc",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"dependencies": {
"@kbn/config-schema": "link:../kbn-config-schema"
}
}
2 changes: 1 addition & 1 deletion src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export const config: {
healthCheck: import("@kbn/config-schema").ObjectType<{
delay: Type<import("moment").Duration>;
}>;
ignoreVersionMismatch: import("@kbn/config-schema/target/types/types").ConditionalType<false, boolean, boolean>;
ignoreVersionMismatch: import("@kbn/config-schema/target/types").ConditionalType<false, boolean, boolean>;
}>;
};
logging: {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_timeseries/common/vis_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { schema } from '@kbn/config-schema';
import { TypeOptions } from '@kbn/config-schema/target/types/types';
import { TypeOptions } from '@kbn/config-schema/target/types';
mistic marked this conversation as resolved.
Show resolved Hide resolved

const stringOptionalNullable = schema.maybe(schema.nullable(schema.string()));
const stringOptional = schema.maybe(schema.string());
Expand Down
1 change: 0 additions & 1 deletion x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
},
"dependencies": {
"@elastic/safer-lodash-set": "link:../packages/elastic-safer-lodash-set",
"@kbn/config-schema": "link:../packages/kbn-config-schema",
"@kbn/i18n": "link:../packages/kbn-i18n",
"@kbn/interpreter": "link:../packages/kbn-interpreter",
"@kbn/ui-framework": "link:../packages/kbn-ui-framework"
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2632,7 +2632,7 @@
version "0.0.0"
uid ""

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

Expand Down