[@kbn/dev-utils] break out more pieces (#132292)

* [@kbn/dev-utils] break out more pieces

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Spencer 2022-05-17 09:19:20 -07:00 committed by GitHub
parent 7dbffc4a40
commit f3d69b8197
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
125 changed files with 741 additions and 113 deletions

View file

@ -488,6 +488,9 @@
"@kbn/ci-stats-core": "link:bazel-bin/packages/kbn-ci-stats-core",
"@kbn/ci-stats-reporter": "link:bazel-bin/packages/kbn-ci-stats-reporter",
"@kbn/cli-dev-mode": "link:bazel-bin/packages/kbn-cli-dev-mode",
"@kbn/dev-cli-errors": "link:bazel-bin/packages/kbn-dev-cli-errors",
"@kbn/dev-cli-runner": "link:bazel-bin/packages/kbn-dev-cli-runner",
"@kbn/dev-proc-runner": "link:bazel-bin/packages/kbn-dev-proc-runner",
"@kbn/dev-utils": "link:bazel-bin/packages/kbn-dev-utils",
"@kbn/docs-utils": "link:bazel-bin/packages/kbn-docs-utils",
"@kbn/es": "link:bazel-bin/packages/kbn-es",
@ -625,6 +628,9 @@
"@types/kbn__config-schema": "link:bazel-bin/packages/kbn-config-schema/npm_module_types",
"@types/kbn__crypto": "link:bazel-bin/packages/kbn-crypto/npm_module_types",
"@types/kbn__datemath": "link:bazel-bin/packages/kbn-datemath/npm_module_types",
"@types/kbn__dev-cli-errors": "link:bazel-bin/packages/kbn-dev-cli-errors/npm_module_types",
"@types/kbn__dev-cli-runner": "link:bazel-bin/packages/kbn-dev-cli-runner/npm_module_types",
"@types/kbn__dev-proc-runner": "link:bazel-bin/packages/kbn-dev-proc-runner/npm_module_types",
"@types/kbn__dev-utils": "link:bazel-bin/packages/kbn-dev-utils/npm_module_types",
"@types/kbn__doc-links": "link:bazel-bin/packages/kbn-doc-links/npm_module_types",
"@types/kbn__docs-utils": "link:bazel-bin/packages/kbn-docs-utils/npm_module_types",

View file

@ -36,6 +36,9 @@ filegroup(
"//packages/kbn-config:build",
"//packages/kbn-crypto:build",
"//packages/kbn-datemath:build",
"//packages/kbn-dev-cli-errors:build",
"//packages/kbn-dev-cli-runner:build",
"//packages/kbn-dev-proc-runner:build",
"//packages/kbn-dev-utils:build",
"//packages/kbn-doc-links:build",
"//packages/kbn-docs-utils:build",
@ -143,6 +146,9 @@ filegroup(
"//packages/kbn-config:build_types",
"//packages/kbn-crypto:build_types",
"//packages/kbn-datemath:build_types",
"//packages/kbn-dev-cli-errors:build_types",
"//packages/kbn-dev-cli-runner:build_types",
"//packages/kbn-dev-proc-runner:build_types",
"//packages/kbn-dev-utils:build_types",
"//packages/kbn-doc-links:build_types",
"//packages/kbn-docs-utils:build_types",

View file

@ -0,0 +1,114 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
PKG_DIRNAME = "kbn-dev-cli-errors"
PKG_REQUIRE_NAME = "@kbn/dev-cli-errors"
SOURCE_FILES = glob(
[
"src/**/*.ts",
],
exclude = [
"**/*.test.*",
],
)
SRCS = SOURCE_FILES
filegroup(
name = "srcs",
srcs = SRCS,
)
NPM_MODULE_EXTRA_FILES = [
"package.json",
]
# In this array place runtime dependencies, including other packages and NPM packages
# which must be available for this code to run.
#
# To reference other packages use:
# "//repo/relative/path/to/package"
# eg. "//packages/kbn-utils"
#
# To reference a NPM package use:
# "@npm//name-of-package"
# eg. "@npm//lodash"
RUNTIME_DEPS = [
]
# In this array place dependencies necessary to build the types, which will include the
# :npm_module_types target of other packages and packages from NPM, including @types/*
# packages.
#
# To reference the types for another package use:
# "//repo/relative/path/to/package:npm_module_types"
# eg. "//packages/kbn-utils:npm_module_types"
#
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"@npm//@types/node",
"@npm//@types/jest",
]
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.bazel.json",
],
)
ts_project(
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = TYPES_DEPS,
declaration = True,
emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src",
tsconfig = ":tsconfig",
)
js_library(
name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
pkg_npm(
name = "npm_module",
deps = [":" + PKG_DIRNAME],
)
filegroup(
name = "build",
srcs = [":npm_module"],
visibility = ["//visibility:public"],
)
pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)
filegroup(
name = "build_types",
srcs = [":npm_module_types"],
visibility = ["//visibility:public"],
)

View file

@ -0,0 +1,3 @@
# @kbn/dev-cli-errors
This package contains the errors used to signal specific types of failures to `@kbn/dev-cli-runner`. The dependencies of `@kbn/dev-cli-runner` also produce these errors so this package needed to be extracted to prevent a circular dependency.

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-dev-cli-errors'],
};

View file

@ -0,0 +1,10 @@
{
"name": "@kbn/dev-cli-errors",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0",
"kibana": {
"devOnly": true
}
}

View file

@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export { combineErrors, createFailError, createFlagError, isFailError } from './dev_cli_errors';

View file

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.bazel.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src",
"stripInternal": false,
"types": [
"jest",
"node"
]
},
"include": [
"src/**/*"
]
}

View file

@ -0,0 +1,136 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
PKG_DIRNAME = "kbn-dev-cli-runner"
PKG_REQUIRE_NAME = "@kbn/dev-cli-runner"
SOURCE_FILES = glob(
[
"src/**/*.ts",
],
exclude = [
"**/*.test.*",
],
)
SRCS = SOURCE_FILES
filegroup(
name = "srcs",
srcs = SRCS,
)
NPM_MODULE_EXTRA_FILES = [
"package.json",
]
# In this array place runtime dependencies, including other packages and NPM packages
# which must be available for this code to run.
#
# To reference other packages use:
# "//repo/relative/path/to/package"
# eg. "//packages/kbn-utils"
#
# To reference a NPM package use:
# "@npm//name-of-package"
# eg. "@npm//lodash"
RUNTIME_DEPS = [
"@npm//chalk",
"@npm//dedent",
"@npm//execa",
"@npm//exit-hook",
"@npm//getopts",
"@npm//normalize-path",
"//packages/kbn-dev-cli-errors",
"//packages/kbn-ci-stats-reporter",
"//packages/kbn-dev-proc-runner",
"//packages/kbn-tooling-log",
"//packages/kbn-utils",
]
# In this array place dependencies necessary to build the types, which will include the
# :npm_module_types target of other packages and packages from NPM, including @types/*
# packages.
#
# To reference the types for another package use:
# "//repo/relative/path/to/package:npm_module_types"
# eg. "//packages/kbn-utils:npm_module_types"
#
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"@npm//@types/node",
"@npm//@types/jest",
"@npm//@types/dedent",
"@npm//@types/normalize-path",
"@npm//chalk",
"@npm//execa",
"@npm//exit-hook",
"@npm//getopts",
"//packages/kbn-dev-cli-errors:npm_module_types",
"//packages/kbn-ci-stats-reporter:npm_module_types",
"//packages/kbn-dev-proc-runner:npm_module_types",
"//packages/kbn-tooling-log:npm_module_types",
"//packages/kbn-utils:npm_module_types",
]
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.bazel.json",
],
)
ts_project(
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = TYPES_DEPS,
declaration = True,
emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src",
tsconfig = ":tsconfig",
)
js_library(
name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
pkg_npm(
name = "npm_module",
deps = [":" + PKG_DIRNAME],
)
filegroup(
name = "build",
srcs = [":npm_module"],
visibility = ["//visibility:public"],
)
pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)
filegroup(
name = "build_types",
srcs = [":npm_module_types"],
visibility = ["//visibility:public"],
)

View file

@ -1,4 +1,4 @@
# @kbn/dev-utils > run()
# @kbn/dev-cli-runner
Helper functions for writing little scripts for random build/ci/dev tasks.
@ -8,7 +8,7 @@ Define the function that should validate the CLI arguments and call your task fn
```ts
// dev/my_task/run_my_task.ts
import { createFlagError, run } from '@kbn/dev-utils';
import { createFlagError, run } from '@kbn/dev-cli-runner';
run(
async ({ flags, log }) => {

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-dev-cli-runner'],
};

View file

@ -0,0 +1,10 @@
{
"name": "@kbn/dev-cli-runner",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0",
"kibana": {
"devOnly": true
}
}

View file

@ -10,8 +10,7 @@ import { inspect } from 'util';
import exitHook from 'exit-hook';
import { ToolingLog } from '@kbn/tooling-log';
import { isFailError } from './fail';
import { isFailError } from '@kbn/dev-cli-errors';
/**
* A function which will be called when the CLI is torn-down which should

View file

@ -7,8 +7,8 @@
*/
import getopts from 'getopts';
import { LOG_LEVEL_FLAGS, DEFAULT_LOG_LEVEL } from '@kbn/tooling-log';
import { RunOptions } from './run';
export interface Flags {

View file

@ -9,7 +9,6 @@
import Path from 'path';
import chalk from 'chalk';
import 'core-js/features/string/repeat';
import dedent from 'dedent';
import { getLogLevelFlagsHelp } from '@kbn/tooling-log';

View file

@ -9,5 +9,4 @@
export * from './run';
export * from './run_with_commands';
export * from './flags';
export * from './fail';
export type { CleanupTask } from './cleanup';

View file

@ -7,8 +7,9 @@
*/
import path from 'path';
import { REPO_ROOT } from '@kbn/utils';
import normalizePath from 'normalize-path';
import { REPO_ROOT } from '@kbn/utils';
import { CiStatsReporter } from '@kbn/ci-stats-reporter';
import { ToolingLog } from '@kbn/tooling-log';

View file

@ -7,9 +7,10 @@
*/
import { pickLevelFromFlags, ToolingLog, LogLevel } from '@kbn/tooling-log';
import { createFlagError } from './fail';
import { ProcRunner, withProcRunner } from '@kbn/dev-proc-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { Flags, getFlags, FlagOptions } from './flags';
import { ProcRunner, withProcRunner } from '../proc_runner';
import { getHelp } from './help';
import { CleanupTask, Cleanup } from './cleanup';
import { Metrics, MetricsMeta } from './metrics';

View file

@ -6,9 +6,10 @@
* Side Public License, v 1.
*/
import { RunWithCommands } from './run_with_commands';
import { ToolingLog, ToolingLogCollectingWriter } from '@kbn/tooling-log';
import { ProcRunner } from '../proc_runner';
import { ProcRunner } from '@kbn/dev-proc-runner';
import { RunWithCommands } from './run_with_commands';
const testLog = new ToolingLog();
const testLogWriter = new ToolingLogCollectingWriter();

View file

@ -7,12 +7,13 @@
*/
import { ToolingLog, pickLevelFromFlags } from '@kbn/tooling-log';
import { withProcRunner } from '@kbn/dev-proc-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { RunContext, RunOptions } from './run';
import { getFlags, FlagOptions, mergeFlagOptions } from './flags';
import { Cleanup } from './cleanup';
import { getHelpForAllCommands, getCommandLevelHelp } from './help';
import { createFlagError } from './fail';
import { withProcRunner } from '../proc_runner';
import { Metrics } from './metrics';
export type CommandRunFn<T> = (context: RunContext & T) => Promise<void> | void;

View file

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.bazel.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src",
"stripInternal": false,
"types": [
"jest",
"node"
]
},
"include": [
"src/**/*"
]
}

View file

@ -0,0 +1,130 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
PKG_DIRNAME = "kbn-dev-proc-runner"
PKG_REQUIRE_NAME = "@kbn/dev-proc-runner"
SOURCE_FILES = glob(
[
"src/**/*.ts",
],
exclude = [
"**/*.test.*",
],
)
SRCS = SOURCE_FILES
filegroup(
name = "srcs",
srcs = SRCS,
)
NPM_MODULE_EXTRA_FILES = [
"package.json",
]
# In this array place runtime dependencies, including other packages and NPM packages
# which must be available for this code to run.
#
# To reference other packages use:
# "//repo/relative/path/to/package"
# eg. "//packages/kbn-utils"
#
# To reference a NPM package use:
# "@npm//name-of-package"
# eg. "@npm//lodash"
RUNTIME_DEPS = [
"@npm//chalk",
"@npm//exit-hook",
"@npm//execa",
"@npm//rxjs",
"@npm//tree-kill",
"//packages/kbn-dev-cli-errors",
"//packages/kbn-tooling-log",
"//packages/kbn-stdio-dev-helpers",
]
# In this array place dependencies necessary to build the types, which will include the
# :npm_module_types target of other packages and packages from NPM, including @types/*
# packages.
#
# To reference the types for another package use:
# "//repo/relative/path/to/package:npm_module_types"
# eg. "//packages/kbn-utils:npm_module_types"
#
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"@npm//@types/node",
"@npm//@types/jest",
"@npm//chalk",
"@npm//exit-hook",
"@npm//execa",
"@npm//rxjs",
"@npm//tree-kill",
"//packages/kbn-dev-cli-errors:npm_module_types",
"//packages/kbn-tooling-log:npm_module_types",
"//packages/kbn-stdio-dev-helpers:npm_module_types",
]
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.bazel.json",
],
)
ts_project(
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = TYPES_DEPS,
declaration = True,
emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src",
tsconfig = ":tsconfig",
)
js_library(
name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
pkg_npm(
name = "npm_module",
deps = [":" + PKG_DIRNAME],
)
filegroup(
name = "build",
srcs = [":npm_module"],
visibility = ["//visibility:public"],
)
pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)
filegroup(
name = "build_types",
srcs = [":npm_module_types"],
visibility = ["//visibility:public"],
)

View file

@ -0,0 +1,3 @@
# @kbn/dev-proc-runner
A class orignally extracted from [`grunt-run`](https://github.com/spalger/grunt-run) which allows running processes without managing the state of the process while it's running, wait for a specific log message or other sign of readiness, and then stop all started processes with a single call.

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-dev-proc-runner'],
};

View file

@ -0,0 +1,10 @@
{
"name": "@kbn/dev-proc-runner",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0",
"kibana": {
"devOnly": true
}
}

View file

@ -6,20 +6,19 @@
* Side Public License, v 1.
*/
import execa from 'execa';
import { statSync } from 'fs';
import { promisify } from 'util';
import execa from 'execa';
import * as Rx from 'rxjs';
import { tap, share, take, mergeMap, map, ignoreElements } from 'rxjs/operators';
import chalk from 'chalk';
import treeKill from 'tree-kill';
import { promisify } from 'util';
const treeKillAsync = promisify((...args: [number, string, any]) => treeKill(...args));
import { ToolingLog } from '@kbn/tooling-log';
import { observeLines } from '@kbn/stdio-dev-helpers';
import { createFailError } from '../run';
import { createFailError } from '@kbn/dev-cli-errors';
const treeKillAsync = promisify((...args: [number, string, any]) => treeKill(...args));
const SECOND = 1000;
const STOP_TIMEOUT = 30 * SECOND;

View file

@ -8,9 +8,9 @@
import * as Rx from 'rxjs';
import exitHook from 'exit-hook';
import { ToolingLog } from '@kbn/tooling-log';
import { createFailError } from '../run';
import { createFailError } from '@kbn/dev-cli-errors';
import { Proc, ProcOptions, startProc } from './proc';
const SECOND = 1000;

View file

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.bazel.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src",
"stripInternal": false,
"types": [
"jest",
"node"
]
},
"include": [
"src/**/*"
]
}

View file

@ -40,6 +40,9 @@ NPM_MODULE_EXTRA_FILES = [
]
RUNTIME_DEPS = [
"//packages/kbn-dev-cli-runner",
"//packages/kbn-dev-cli-errors",
"//packages/kbn-dev-proc-runner",
"//packages/kbn-std",
"//packages/kbn-utils",
"//packages/kbn-plugin-discovery",
@ -71,6 +74,9 @@ RUNTIME_DEPS = [
]
TYPES_DEPS = [
"//packages/kbn-dev-cli-runner:npm_module_types",
"//packages/kbn-dev-cli-errors:npm_module_types",
"//packages/kbn-dev-proc-runner:npm_module_types",
"//packages/kbn-std:npm_module_types",
"//packages/kbn-utils:npm_module_types",
"//packages/kbn-plugin-discovery:npm_module_types",

View file

@ -6,7 +6,6 @@
* Side Public License, v 1.
*/
export { withProcRunner, ProcRunner } from './proc_runner';
export {
CA_CERT_PATH,
ES_KEY_PATH,
@ -20,7 +19,6 @@ export {
KBN_P12_PATH,
KBN_P12_PASSWORD,
} from './certs';
export * from './run';
export * from './axios';
export * from './ship_ci_stats_cli';
export * from './plugin_list';

View file

@ -10,7 +10,7 @@ import Path from 'path';
import Fs from 'fs';
import { REPO_ROOT } from '@kbn/utils';
import { run } from '../run';
import { run } from '@kbn/dev-cli-runner';
import { discoverPlugins } from './discover_plugins';
import { generatePluginList } from './generate_plugin_list';

View file

@ -11,8 +11,8 @@ import { chmod, writeFile } from 'fs';
import { promisify } from 'util';
import { REPO_ROOT } from '@kbn/utils';
import { run } from '../run';
import { createFailError } from '../run';
import { run } from '@kbn/dev-cli-runner';
import { createFailError } from '@kbn/dev-cli-errors';
import { SCRIPT_SOURCE } from './script_source';
import { getGitDir, isCorrectGitVersionInstalled } from './git_utils';

View file

@ -11,7 +11,8 @@ import Fs from 'fs';
import { CiStatsReporter } from '@kbn/ci-stats-reporter';
import { run, createFlagError, createFailError } from './run';
import { createFlagError, createFailError } from '@kbn/dev-cli-errors';
import { run } from '@kbn/dev-cli-runner';
export function shipCiStatsCli() {
run(

View file

@ -12,7 +12,7 @@ import Fsp from 'fs/promises';
import { REPO_ROOT } from '@kbn/utils';
import dedent from 'dedent';
import { run } from '../run';
import { run } from '@kbn/dev-cli-runner';
import { MANAGED_CONFIG_KEYS, MANAGED_CONFIG_FILES } from './managed_config_keys';
import { updateVscodeConfig } from './update_vscode_config';

View file

@ -9,7 +9,8 @@
import Fs from 'fs';
import Path from 'path';
import { run, createFlagError } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { CiStatsReporter } from '@kbn/ci-stats-reporter';
import { REPO_ROOT } from '@kbn/utils';
import { Project } from 'ts-morph';

View file

@ -17,7 +17,9 @@ import Url from 'url';
import readline from 'readline';
import Fs from 'fs';
import { RunWithCommands, createFlagError, CA_CERT_PATH } from '@kbn/dev-utils';
import { CA_CERT_PATH } from '@kbn/dev-utils';
import { RunWithCommands } from '@kbn/dev-cli-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { readConfigFile, KbnClient, EsVersion } from '@kbn/test';
import { Client, HttpConnection } from '@elastic/elasticsearch';

View file

@ -9,7 +9,7 @@
import path from 'path';
import os from 'os';
import { withProcRunner } from '@kbn/dev-utils';
import { withProcRunner } from '@kbn/dev-proc-runner';
import { ToolingLog } from '@kbn/tooling-log';
import { createCliError } from '../errors';

View file

@ -187,6 +187,44 @@ module.exports = {
'sortPackageJson',
]
},
{
fromPackage: '@kbn/dev-utils',
toPackage: '@kbn/dev-cli-runner',
exportNames: [
'run',
'Command',
'RunWithCommands',
'CleanupTask',
'Command',
'CommandRunFn',
'FlagOptions',
'Flags',
'RunContext',
'RunFn',
'RunOptions',
'RunWithCommands',
'RunWithCommandsOptions',
'getFlags',
'mergeFlagOptions'
]
},
{
fromPackage: '@kbn/dev-utils',
toPackage: '@kbn/dev-cli-errors',
exportNames: [
'createFailError',
'createFlagError',
'isFailError',
]
},
{
fromPackage: '@kbn/dev-utils',
toPackage: '@kbn/dev-proc-runner',
exportNames: [
'withProcRunner',
'ProcRunner',
]
},
]],
'@kbn/eslint/no_async_promise_body': 'error',

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { RunWithCommands } from '@kbn/dev-utils';
import { RunWithCommands } from '@kbn/dev-cli-runner';
import { Render } from './lib/render';
import { ContextExtensions } from './generate_command';

View file

@ -16,7 +16,7 @@ import { ESLint } from 'eslint';
import micromatch from 'micromatch';
import { REPO_ROOT } from '@kbn/utils';
import { discoverBazelPackages, BAZEL_PACKAGE_DIRS } from '@kbn/bazel-packages';
import { createFailError, createFlagError, isFailError } from '@kbn/dev-utils';
import { createFailError, createFlagError, isFailError } from '@kbn/dev-cli-errors';
import { sortPackageJson } from '@kbn/sort-package-json';
import { TEMPLATE_DIR, ROOT_PKG_DIR, PKG_TEMPLATE_DIR } from '../paths';

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { Command } from '@kbn/dev-utils';
import { Command } from '@kbn/dev-cli-runner';
import { Render } from './lib/render';

View file

@ -9,7 +9,8 @@
import Fsp from 'fs/promises';
import Path from 'path';
import { createFailError, diffStrings } from '@kbn/dev-utils';
import { diffStrings } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { ToolingLog } from '@kbn/tooling-log';
export async function validateFile(log: ToolingLog, usage: string, path: string, expected: string) {

View file

@ -8,7 +8,7 @@
import Path from 'path';
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { REPO_ROOT } from '@kbn/utils';
import { OptimizerConfig } from '../optimizer';

View file

@ -8,7 +8,7 @@
import Path from 'path';
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { REPO_ROOT } from '@kbn/utils';
import { OptimizerConfig } from '../optimizer';

View file

@ -8,7 +8,7 @@
import Path from 'path';
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { REPO_ROOT } from '@kbn/utils';
import { OptimizerConfig } from '../optimizer';

View file

@ -10,7 +10,8 @@ import Path from 'path';
import { REPO_ROOT } from '@kbn/utils';
import { lastValueFrom } from 'rxjs';
import { run, createFlagError, Flags } from '@kbn/dev-utils';
import { run, Flags } from '@kbn/dev-cli-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { logOptimizerState } from './log_optimizer_state';
import { logOptimizerProgress } from './log_optimizer_progress';

View file

@ -11,7 +11,7 @@ import Path from 'path';
import dedent from 'dedent';
import Yaml from 'js-yaml';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { ToolingLog } from '@kbn/tooling-log';
import { CiStatsMetric } from '@kbn/ci-stats-reporter';

View file

@ -7,7 +7,7 @@
*/
import { tap } from 'rxjs/operators';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { pipeClosure } from '../common';
import { OptimizerUpdate$ } from '../run_optimizer';

View file

@ -12,7 +12,8 @@
*
*************************************************************/
import { run, createFlagError } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { extractor } from './extractor';
export async function runExtractor() {

View file

@ -11,7 +11,8 @@ import Fs from 'fs';
import execa from 'execa';
import { REPO_ROOT } from '@kbn/utils';
import { run, createFailError, createFlagError } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { createFailError, createFlagError } from '@kbn/dev-cli-errors';
import { snakeCase } from './casing';
import { askQuestions, getDefaultAnswers } from './ask_questions';

View file

@ -8,7 +8,8 @@
import Path from 'path';
import { RunWithCommands, createFlagError, createFailError } from '@kbn/dev-utils';
import { RunWithCommands } from '@kbn/dev-cli-runner';
import { createFlagError, createFailError } from '@kbn/dev-cli-errors';
import { findKibanaJson } from './find_kibana_json';
import { loadKibanaPlatformPlugin } from './load_kibana_platform_plugin';

View file

@ -10,7 +10,7 @@ import Path from 'path';
import { REPO_ROOT } from '@kbn/utils';
import { parseKibanaPlatformPlugin, KibanaPlatformPlugin } from '@kbn/plugin-discovery';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
export type Plugin = KibanaPlatformPlugin;

View file

@ -9,7 +9,7 @@
import { join } from 'path';
import { logger } from '@storybook/node-logger';
import buildStandalone from '@storybook/react/standalone';
import { Flags, run } from '@kbn/dev-utils';
import { Flags, run } from '@kbn/dev-cli-runner';
import UiSharedDepsNpm from '@kbn/ui-shared-deps-npm';
import * as UiSharedDepsSrc from '@kbn/ui-shared-deps-src';
import * as constants from './constants';

View file

@ -8,7 +8,8 @@
import Listr from 'listr';
import chalk from 'chalk';
import { createFailError, run } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { run } from '@kbn/dev-cli-runner';
import {
createTaskContext,

View file

@ -7,7 +7,7 @@
*/
import Listr from 'listr';
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import {
createTaskContext,

View file

@ -7,7 +7,7 @@
*/
import * as ts from 'typescript';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import * as path from 'path';
import { getProperty, getPropertyValue } from './utils';
import { getDescriptor, Descriptor } from './serializer';

View file

@ -7,7 +7,7 @@
*/
import { Client, HttpConnection } from '@elastic/elasticsearch';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { ToolingLog } from '@kbn/tooling-log';
import { TestFailure } from './get_failures';

View file

@ -9,7 +9,8 @@
import Path from 'path';
import { REPO_ROOT } from '@kbn/utils';
import { run, createFailError, createFlagError } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { createFailError, createFlagError } from '@kbn/dev-cli-errors';
import { CiStatsReporter } from '@kbn/ci-stats-reporter';
import globby from 'globby';
import normalize from 'normalize-path';

View file

@ -9,7 +9,8 @@
import Path from 'path';
import { inspect } from 'util';
import { run, createFlagError, Flags } from '@kbn/dev-utils';
import { run, Flags } from '@kbn/dev-cli-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { ToolingLog } from '@kbn/tooling-log';
import { getTimeReporter } from '@kbn/ci-stats-reporter';
import exitHook from 'exit-hook';

View file

@ -9,7 +9,7 @@
import Path from 'path';
import { ToolingLog } from '@kbn/tooling-log';
import { defaultsDeep } from 'lodash';
import { createFlagError } from '@kbn/dev-utils';
import { createFlagError } from '@kbn/dev-cli-errors';
import { REPO_ROOT } from '@kbn/utils';
import { Config } from './config';

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { ProcRunner } from '@kbn/dev-utils';
import type { ProcRunner } from '@kbn/dev-proc-runner';
import { resolve, relative } from 'path';
import { KIBANA_ROOT, KIBANA_EXEC, KIBANA_EXEC_PATH } from './paths';
import type { Config } from '../../functional_test_runner';

View file

@ -10,7 +10,7 @@ import { relative } from 'path';
import * as Rx from 'rxjs';
import { setTimeout } from 'timers/promises';
import { startWith, switchMap, take } from 'rxjs/operators';
import { withProcRunner } from '@kbn/dev-utils';
import { withProcRunner } from '@kbn/dev-proc-runner';
import { ToolingLog } from '@kbn/tooling-log';
import { getTimeReporter } from '@kbn/ci-stats-reporter';
import { REPO_ROOT } from '@kbn/utils';

View file

@ -10,7 +10,8 @@ import { writeFileSync } from 'fs';
import path from 'path';
import Mustache from 'mustache';
import { run, createFailError } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { createFailError } from '@kbn/dev-cli-errors';
import { REPO_ROOT } from '@kbn/utils';
import { getAllRepoRelativeBazelPackageDirs } from '@kbn/bazel-packages';

View file

@ -9,7 +9,8 @@
import Path from 'path';
import Url from 'url';
import { RunWithCommands, createFlagError, Flags } from '@kbn/dev-utils';
import { RunWithCommands, Flags } from '@kbn/dev-cli-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { KbnClient } from './kbn_client';
import { readConfigFile, EsVersion } from './functional_test_runner';

View file

@ -12,7 +12,8 @@ import { existsSync } from 'fs';
import Path from 'path';
import FormData from 'form-data';
import { isAxiosResponseError, createFailError } from '@kbn/dev-utils';
import { isAxiosResponseError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { ToolingLog } from '@kbn/tooling-log';
import { REPO_ROOT } from '@kbn/utils';

View file

@ -10,7 +10,8 @@ import { inspect } from 'util';
import * as Rx from 'rxjs';
import { mergeMap } from 'rxjs/operators';
import { isAxiosResponseError, createFailError } from '@kbn/dev-utils';
import { isAxiosResponseError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { ToolingLog } from '@kbn/tooling-log';
import { KbnClientRequester, uriencode } from './kbn_client_requester';

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { ToolingLog } from '@kbn/tooling-log';
import { REPO_ROOT } from '@kbn/utils';
import chalk from 'chalk';

View file

@ -8,7 +8,8 @@
import { resolve } from 'path';
import { prok } from './process';
import { run, createFlagError, createFailError } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { createFlagError, createFailError } from '@kbn/dev-cli-errors';
import { pathExists } from './team_assignment/enumeration_helpers';
import { always, ccMark } from './utils';

View file

@ -6,7 +6,8 @@
* Side Public License, v 1.
*/
import { run, createFlagError } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { REPO_ROOT } from '@kbn/utils';
import { parse } from './parse_owners';
import { flush } from './flush';

View file

@ -12,7 +12,7 @@ import Fs from 'fs/promises';
import execa from 'execa';
import { safeLoad } from 'js-yaml';
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { REPO_ROOT } from '@kbn/utils';
import { schema } from '@kbn/config-schema';

View file

@ -9,7 +9,7 @@
import { CLIEngine } from 'eslint';
import { REPO_ROOT } from '@kbn/utils';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { ToolingLog } from '@kbn/tooling-log';
import { File } from '../file';

View file

@ -14,7 +14,8 @@ import execa from 'execa';
import * as Rx from 'rxjs';
import { mergeMap, reduce } from 'rxjs/operators';
import { supportsColor } from 'chalk';
import { run, createFailError } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { createFailError } from '@kbn/dev-cli-errors';
import { REPO_ROOT } from '@kbn/utils';
import { PROJECTS } from '../typescript/projects';

View file

@ -6,7 +6,8 @@
* Side Public License, v 1.
*/
import { run, createFlagError, Flags } from '@kbn/dev-utils';
import { run, Flags } from '@kbn/dev-cli-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import fs from 'fs';
import Path from 'path';
import { savePrsToCsv } from './search_and_save_pr_list';

View file

@ -11,7 +11,7 @@ import path from 'path';
import { extractCodeMessages } from './extractors';
import { globAsync, readFileAsync, normalizePath } from './utils';
import { createFailError, isFailError } from '@kbn/dev-utils';
import { createFailError, isFailError } from '@kbn/dev-cli-errors';
function addMessageToMap(targetMap, key, value, reporter) {
const existingValue = targetMap.get(key);

View file

@ -18,7 +18,7 @@ import {
import { extractI18nCallMessages } from './i18n_call';
import { createParserErrorMessage, isI18nTranslateFunction, traverseNodes } from '../utils';
import { extractIntlMessages, extractFormattedMessages } from './react';
import { createFailError, isFailError } from '@kbn/dev-utils';
import { createFailError, isFailError } from '@kbn/dev-cli-errors';
/**
* Detect Intl.formatMessage() function call (React).

View file

@ -18,7 +18,7 @@ import {
extractValuesKeysFromNode,
} from '../utils';
import { DEFAULT_MESSAGE_KEY, DESCRIPTION_KEY, VALUES_KEY } from '../constants';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
/**
* Extract messages from `funcName('id', { defaultMessage: 'Message text' })` call expression AST

View file

@ -19,7 +19,7 @@ import {
checkValuesProperty,
} from '../utils';
import { DEFAULT_MESSAGE_KEY, VALUES_KEY, DESCRIPTION_KEY } from '../constants';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
/**
* Extract default messages from ReactJS intl.formatMessage(...) AST

View file

@ -10,7 +10,7 @@ import { ToolingLog } from '@kbn/tooling-log';
import { i18n } from '@kbn/i18n';
import path from 'path';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import {
accessAsync,
checkValuesProperty,

View file

@ -7,7 +7,7 @@
*/
import chalk from 'chalk';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { ErrorReporter, extractMessagesFromPathToMap, filterConfigPaths, I18nConfig } from '..';
export function extractDefaultMessages(config: I18nConfig, inputPaths: string[]) {

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import {
I18nConfig,
matchEntriesWithExctractors,

View file

@ -25,7 +25,7 @@ import path from 'path';
import chalk from 'chalk';
import parser from 'intl-messageformat-parser';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
const ESCAPE_LINE_BREAK_REGEX = /(?<!\\)\\\n/g;
const HTML_LINE_BREAK_REGEX = /[\s]*\n[\s]*/g;

View file

@ -7,7 +7,7 @@
*/
import { REPO_ROOT } from '@kbn/utils';
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { getInstalledPackages } from '../npm';
import { LICENSE_ALLOWED, DEV_ONLY_LICENSE_ALLOWED, LICENSE_OVERRIDES } from './config';

View file

@ -7,7 +7,7 @@
*/
import dedent from 'dedent';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
interface Options {
packages: Array<{

View file

@ -10,7 +10,7 @@ import { relative, basename } from 'path';
import { dim } from 'chalk';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { matchesAnyGlob } from '../globs';
import {

View file

@ -8,7 +8,7 @@
import axios, { AxiosError, AxiosResponse, AxiosInstance } from 'axios';
import { createFailError } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
interface ResponseError extends AxiosError {
request: any;

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { createFlagError } from '@kbn/dev-utils';
import { createFlagError } from '@kbn/dev-cli-errors';
const isNum = (input: string) => {
return /^\d+$/.test(input);

View file

@ -14,7 +14,8 @@ import chalk from 'chalk';
import { first, tap } from 'rxjs/operators';
import dedent from 'dedent';
import { run, createFlagError } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { getLine$ } from './helpers';
import { Pr } from './pr';
import { GithubApi } from './github_api';

View file

@ -9,7 +9,8 @@
import Path from 'path';
import dedent from 'dedent';
import { run, createFailError } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { createFailError } from '@kbn/dev-cli-errors';
import { REPO_ROOT } from '@kbn/utils';
const DEFAULT_DOC_REPO_PATH = Path.resolve(REPO_ROOT, '..', 'docs');

View file

@ -9,7 +9,7 @@
import globby from 'globby';
import { REPO_ROOT } from '@kbn/utils';
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { File } from './file';
// @ts-expect-error precommit hooks aren't migrated to TypeScript yet.
import { checkFileCasing } from './precommit_hook/check_file_casing';

View file

@ -10,7 +10,7 @@ import Path from 'path';
import Fs from 'fs';
import JSON5 from 'json5';
import { get } from 'lodash';
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { KibanaPlatformPlugin } from '@kbn/plugin-discovery';
import { getPluginDeps, findPlugins } from './plugin_discovery';

View file

@ -10,7 +10,7 @@ import dedent from 'dedent';
import { parseDependencyTree, parseCircular, prettyCircular } from 'dpdm';
import { relative } from 'path';
import { getPluginSearchPaths } from '@kbn/plugin-discovery';
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { REPO_ROOT } from '@kbn/utils';
interface Options {

View file

@ -10,7 +10,7 @@ import Path from 'path';
import Fs from 'fs';
import JSON5 from 'json5';
import { get } from 'lodash';
import { run } from '@kbn/dev-utils';
import { run } from '@kbn/dev-cli-runner';
import { getPluginDeps, findPlugins } from './plugin_discovery';
interface AllOptions {

View file

@ -9,7 +9,8 @@
import chalk from 'chalk';
import Listr from 'listr';
import { createFailError, run } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { run } from '@kbn/dev-cli-runner';
import { ToolingLog } from '@kbn/tooling-log';
import { getTimeReporter } from '@kbn/ci-stats-reporter';
import { ErrorReporter, I18nConfig } from './i18n';

View file

@ -10,7 +10,8 @@ import chalk from 'chalk';
import Listr from 'listr';
import { resolve } from 'path';
import { createFailError, run } from '@kbn/dev-utils';
import { createFailError } from '@kbn/dev-cli-errors';
import { run } from '@kbn/dev-cli-runner';
import { ErrorReporter, serializeToJson, serializeToJson5, writeFileAsync } from './i18n';
import { extractDefaultMessages, mergeConfigs } from './i18n/tasks';

Some files were not shown because too many files have changed in this diff Show more