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

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

* chore(NA): correctly format packages for the new bazel standards

* chore(NA): correctly maps srcs into source_files

* chore(NA): remove config-schema dep from legacy built packages package.jsons

* chore(NA): include kbn/config-schema in the list of bazel packages to be built

* chore(NA): change import to fix typechecking

* chore(NA): remove dependency on new package built by bazel

* chore(NA): be more explicit about incremental setting

* chore(NA): include pretty in the args for ts_project rule

* docs(NA): include package migration completion in the developer getting started

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
This commit is contained in:
Kibana Machine 2021-04-14 11:45:59 -04:00 committed by GitHub
parent aae42b8b45
commit 769b632901
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 101 additions and 26 deletions

View file

@ -63,5 +63,5 @@ yarn kbn watch-bazel
- @elastic/datemath
- @kbn/apm-utils
- @kbn/config-schema

View file

@ -124,7 +124,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",

View file

@ -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"
],
)

View file

@ -15,7 +15,6 @@
},
"dependencies": {
"@kbn/config": "link:../kbn-config",
"@kbn/config-schema": "link:../kbn-config-schema",
"@kbn/logging": "link:../kbn-logging",
"@kbn/server-http-tools": "link:../kbn-server-http-tools",
"@kbn/optimizer": "link:../kbn-optimizer",

View file

@ -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"],
)

View file

@ -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
}

View file

@ -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",
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../../packages/kbn-config-schema/src",
"stripInternal": true,
"types": [
"jest",
"node"

View file

@ -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"
},

View file

@ -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"
}
}

View file

@ -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"
},

View file

@ -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"
}
}

View file

@ -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: {

View file

@ -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';
const stringOptionalNullable = schema.maybe(schema.nullable(schema.string()));
const stringOptional = schema.maybe(schema.string());

View file

@ -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"

View file

@ -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 ""