mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
chore(NA): moving @kbn/utils to babel transpiler (#107010)
* chore(NA): moving @kbn/utils to babel transpiler * chore(NA): changed import paths for that module on kbn-apm-config-loader * fix(NA): import on test file Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
3f14abb372
commit
1137c2c5f4
7 changed files with 27 additions and 14 deletions
|
@ -10,7 +10,7 @@ import { join } from 'path';
|
|||
import { merge } from 'lodash';
|
||||
import { execSync } from 'child_process';
|
||||
// deep import to avoid loading the whole package
|
||||
import { getDataPath } from '@kbn/utils/target/path';
|
||||
import { getDataPath } from '@kbn/utils';
|
||||
import { readFileSync } from 'fs';
|
||||
import { ApmAgentConfig } from './types';
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { resolve } from 'path';
|
||||
// deep import to avoid loading the whole package
|
||||
import { getConfigPath } from '@kbn/utils/target/path';
|
||||
import { getConfigPath } from '@kbn/utils';
|
||||
import { getArgValues } from './read_argv';
|
||||
|
||||
/**
|
||||
|
|
3
packages/kbn-utils/.babelrc
Normal file
3
packages/kbn-utils/.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-utils"
|
||||
PKG_REQUIRE_NAME = "@kbn/utils"
|
||||
|
@ -23,18 +24,25 @@ NPM_MODULE_EXTRA_FILES = [
|
|||
"README.md"
|
||||
]
|
||||
|
||||
SRC_DEPS = [
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/kbn-config-schema",
|
||||
"@npm//load-json-file",
|
||||
"@npm//tslib",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"//packages/kbn-config-schema",
|
||||
"@npm//load-json-file",
|
||||
"@npm//tslib",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/node",
|
||||
]
|
||||
|
||||
DEPS = SRC_DEPS + TYPES_DEPS
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
|
@ -45,14 +53,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",
|
||||
|
@ -61,7 +70,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/utils",
|
||||
"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,10 +1,11 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"incremental": true,
|
||||
"outDir": "target",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"incremental": false,
|
||||
"outDir": "target_types",
|
||||
"sourceMap": true,
|
||||
"sourceRoot": "../../../../packages/kbn-utils/src",
|
||||
"types": [
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import { Logger } from '../cli_plugin/lib/logger';
|
||||
import { confirm, question } from './utils';
|
||||
// import from path since add.test.js mocks 'fs' required for @kbn/utils
|
||||
import { createPromiseFromStreams, createConcatStream } from '@kbn/utils/target/streams';
|
||||
import { createPromiseFromStreams, createConcatStream } from '@kbn/utils/target_node/streams';
|
||||
|
||||
/**
|
||||
* @param {Keystore} keystore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue