mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
chore(NA): moving @kbn/config to babel transpiler (#107763)
* chore(NA): moving @kbn/config to babel transpiler * chore(NA): fix types * chore(NA): include missing deps Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
21f4de833c
commit
2558194f80
9 changed files with 55 additions and 22 deletions
3
packages/kbn-config/.babelrc
Normal file
3
packages/kbn-config/.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"presets": ["@kbn/babel-preset/node_preset"]
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
||||
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
|
||||
|
||||
PKG_BASE_NAME = "kbn-config"
|
||||
PKG_REQUIRE_NAME = "@kbn/config"
|
||||
|
@ -28,7 +29,7 @@ NPM_MODULE_EXTRA_FILES = [
|
|||
"README.md"
|
||||
]
|
||||
|
||||
SRC_DEPS = [
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/elastic-safer-lodash-set",
|
||||
"//packages/kbn-config-schema",
|
||||
"//packages/kbn-logging",
|
||||
|
@ -42,6 +43,13 @@ SRC_DEPS = [
|
|||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"//packages/elastic-safer-lodash-set",
|
||||
"//packages/kbn-config-schema",
|
||||
"//packages/kbn-logging",
|
||||
"//packages/kbn-std",
|
||||
"//packages/kbn-utility-types",
|
||||
"@npm//load-json-file",
|
||||
"@npm//rxjs",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/js-yaml",
|
||||
"@npm//@types/lodash",
|
||||
|
@ -49,7 +57,11 @@ TYPES_DEPS = [
|
|||
"@npm//@types/type-detect",
|
||||
]
|
||||
|
||||
DEPS = SRC_DEPS + TYPES_DEPS
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
|
@ -60,14 +72,15 @@ ts_config(
|
|||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc",
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = DEPS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
incremental = True,
|
||||
out_dir = "target",
|
||||
emit_declaration_only = True,
|
||||
incremental = False,
|
||||
out_dir = "target_types",
|
||||
source_map = True,
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
|
@ -76,7 +89,7 @@ ts_project(
|
|||
js_library(
|
||||
name = PKG_BASE_NAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = DEPS + [":tsc"],
|
||||
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@kbn/config",
|
||||
"main": "./target/index.js",
|
||||
"types": "./target/index.d.ts",
|
||||
"main": "./target_node/index.js",
|
||||
"types": "./target_types/index.d.ts",
|
||||
"version": "1.0.0",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"private": true
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"incremental": true,
|
||||
"outDir": "./target",
|
||||
"stripInternal": false,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"incremental": false,
|
||||
"outDir": "./target_types",
|
||||
"rootDir": "src",
|
||||
"sourceMap": true,
|
||||
"sourceRoot": "../../../../packages/kbn-config/src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
|
|
|
@ -6,9 +6,24 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export {
|
||||
getEnvOptions,
|
||||
rawConfigServiceMock,
|
||||
configServiceMock,
|
||||
configMock,
|
||||
} from '@kbn/config/target/mocks';
|
||||
import type {
|
||||
getEnvOptions as getEnvOptionsTyped,
|
||||
rawConfigServiceMock as rawConfigServiceMockTyped,
|
||||
configServiceMock as configServiceMockTyped,
|
||||
configMock as configMockTyped,
|
||||
} from '@kbn/config/target_types/mocks';
|
||||
|
||||
import {
|
||||
getEnvOptions as getEnvOptionsNonTyped,
|
||||
rawConfigServiceMock as rawConfigServiceMockNonTyped,
|
||||
configServiceMock as configServiceMockNonTyped,
|
||||
configMock as configMockNonTyped,
|
||||
// @ts-expect-error
|
||||
} from '@kbn/config/target_node/mocks';
|
||||
|
||||
const getEnvOptions: typeof getEnvOptionsTyped = getEnvOptionsNonTyped;
|
||||
const rawConfigServiceMock: typeof rawConfigServiceMockTyped = rawConfigServiceMockNonTyped;
|
||||
const configServiceMock: typeof configServiceMockTyped = configServiceMockNonTyped;
|
||||
const configMock: typeof configMockTyped = configMockNonTyped;
|
||||
|
||||
export { getEnvOptions, rawConfigServiceMock, configServiceMock, configMock };
|
||||
|
|
|
@ -12,7 +12,7 @@ import Util from 'util';
|
|||
import Semver from 'semver';
|
||||
import { REPO_ROOT } from '@kbn/dev-utils';
|
||||
import { Env } from '@kbn/config';
|
||||
import { getEnvOptions } from '@kbn/config/target/mocks';
|
||||
import { getEnvOptions } from '../../../config/mocks';
|
||||
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
|
||||
import { ElasticsearchClient } from '../../../elasticsearch';
|
||||
import { SavedObjectsRawDoc } from '../../serialization';
|
||||
|
|
|
@ -10,7 +10,7 @@ import path from 'path';
|
|||
import { unlink } from 'fs/promises';
|
||||
import { REPO_ROOT } from '@kbn/dev-utils';
|
||||
import { Env } from '@kbn/config';
|
||||
import { getEnvOptions } from '@kbn/config/target/mocks';
|
||||
import { getEnvOptions } from '../../../config/mocks';
|
||||
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
|
||||
import { ElasticsearchClient } from '../../../elasticsearch';
|
||||
import { InternalCoreStart } from '../../../internal_types';
|
||||
|
|
|
@ -15,7 +15,7 @@ import JSON5 from 'json5';
|
|||
import { ElasticsearchClient } from '../../../elasticsearch';
|
||||
import { Env } from '@kbn/config';
|
||||
import { REPO_ROOT } from '@kbn/utils';
|
||||
import { getEnvOptions } from '@kbn/config/target/mocks';
|
||||
import { getEnvOptions } from '../../../config/mocks';
|
||||
|
||||
const kibanaVersion = Env.createDefault(REPO_ROOT, getEnvOptions()).packageInfo.version;
|
||||
const targetIndex = `.kibana_${kibanaVersion}_001`;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { Env } from '@kbn/config';
|
||||
import { REPO_ROOT } from '@kbn/dev-utils';
|
||||
import { getEnvOptions } from '@kbn/config/target/mocks';
|
||||
import { getEnvOptions } from '../../config/mocks';
|
||||
import { startServers, stopServers } from './lib';
|
||||
import { docExistsSuite } from './doc_exists';
|
||||
import { docMissingSuite } from './doc_missing';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue