Skip to content

Commit

Permalink
chore(NA): moving @kbn/dev-utils to babel transpiler (#107245) (#107341)
Browse files Browse the repository at this point in the history
* chore(NA): moving @kbn/dev-utils to babel transpiler

* chore(NA): fix types field on tsconfig files for packages missing it

* chore(NA): update package.jsons

* chore(NA): update kbn/pm dist

* chore(NA): update types field on package jsons

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	packages/kbn-dev-utils/BUILD.bazel
#	packages/kbn-pm/dist/index.js
  • Loading branch information
mistic authored Jul 31, 2021
1 parent ec558a9 commit d919a64
Show file tree
Hide file tree
Showing 18 changed files with 3,280 additions and 3,313 deletions.
2 changes: 1 addition & 1 deletion docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ NOTE:

node scripts/build_plugin_list_docs

You can update the template within node_modules/@kbn/dev-utils/target/plugin_list/generate_plugin_list.js
You can update the template within node_modules/@kbn/dev-utils/target_node/plugin_list/generate_plugin_list.js

////
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-cli-dev-mode/src/cli_dev_mode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const { DevServer } = jest.requireMock('./dev_server');
jest.mock('./base_path_proxy_server');
const { BasePathProxyServer } = jest.requireMock('./base_path_proxy_server');

jest.mock('@kbn/dev-utils/target/ci_stats_reporter');
const { CiStatsReporter } = jest.requireMock('@kbn/dev-utils/target/ci_stats_reporter');
jest.mock('@kbn/dev-utils/ci_stats_reporter');
const { CiStatsReporter } = jest.requireMock('@kbn/dev-utils/ci_stats_reporter');

jest.mock('./get_server_watch_paths', () => ({
getServerWatchPaths: jest.fn(() => ({
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-crypto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ NPM_MODULE_EXTRA_FILES = [

SRC_DEPS = [
"//packages/kbn-dev-utils",
"@npm//jest-styled-components",
"@npm//node-forge",
]

Expand Down
6 changes: 5 additions & 1 deletion packages/kbn-crypto/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
"declarationMap": true,
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-crypto/src"
"sourceRoot": "../../../../packages/kbn-crypto/src",
"types": [
"jest",
"node"
]
},
"include": ["src/**/*"]
}
3 changes: 3 additions & 0 deletions packages/kbn-dev-utils/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/node_preset"]
}
38 changes: 25 additions & 13 deletions packages/kbn-dev-utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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-dev-utils"
PKG_REQUIRE_NAME = "@kbn/dev-utils"
Expand Down Expand Up @@ -41,32 +42,38 @@ NPM_MODULE_EXTRA_FILES = [
"tooling_log/package.json"
]

SRC_DEPS = [
"//packages/kbn-expect",
RUNTIME_DEPS = [
"//packages/kbn-std",
"//packages/kbn-utils",
"@npm//@babel/core",
"@npm//axios",
"@npm//chalk",
"@npm//chance",
"@npm//cheerio",
"@npm//dedent",
"@npm//execa",
"@npm//exit-hook",
"@npm//getopts",
"@npm//globby",
"@npm//jest-styled-components",
"@npm//load-json-file",
"@npm//markdown-it",
"@npm//moment",
"@npm//normalize-path",
"@npm//rxjs",
"@npm//tree-kill",
"@npm//tslib",
"@npm//typescript",
"@npm//vinyl"
"@npm//vinyl",
"@npm//yauzl"
]

TYPES_DEPS = [
"//packages/kbn-std",
"//packages/kbn-utils",
"@npm//axios",
"@npm//execa",
"@npm//exit-hook",
"@npm//getopts",
"@npm//globby",
"@npm//rxjs",
"@npm//tree-kill",
"@npm//@types/babel__core",
"@npm//@types/cheerio",
"@npm//@types/dedent",
Expand All @@ -80,7 +87,11 @@ TYPES_DEPS = [
"@npm//@types/vinyl"
]

DEPS = SRC_DEPS + TYPES_DEPS
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)

ts_config(
name = "tsconfig",
Expand All @@ -91,14 +102,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",
Expand All @@ -107,7 +119,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"],
)
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-dev-utils/ci_stats_reporter/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "../target/ci_stats_reporter/ci_stats_reporter"
"main": "../target_node/ci_stats_reporter/ci_stats_reporter",
"types": "../target_types/ci_stats_reporter/ci_stats_reporter"
}
4 changes: 2 additions & 2 deletions packages/kbn-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "1.0.0",
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js",
"types": "./target/index.d.ts",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"kibana": {
"devOnly": true
}
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-dev-utils/stdio/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "../target/stdio"
"main": "../target_node/stdio",
"types": "../target_types/stdio"
}
3 changes: 2 additions & 1 deletion packages/kbn-dev-utils/tooling_log/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "../target/tooling_log"
"main": "../target_node/tooling_log",
"types": "../target_types/tooling_log"
}
9 changes: 5 additions & 4 deletions packages/kbn-dev-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": true,
"outDir": "target",
"stripInternal": false,
"target": "ES2019",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"incremental": false,
"outDir": "target_types",
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-dev-utils/src",
"stripInternal": false,
"target": "ES2019",
"types": [
"jest",
"node"
Expand Down
6 changes: 5 additions & 1 deletion packages/kbn-optimizer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
"declarationMap": true,
"rootDir": "./src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-optimizer/src"
"sourceRoot": "../../../../packages/kbn-optimizer/src",
"types": [
"jest",
"node"
]
},
"include": [
"src/**/*"
Expand Down
Loading

0 comments on commit d919a64

Please sign in to comment.