Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@
"@kbn/babel-plugin-synthetic-packages": "link:bazel-bin/packages/kbn-babel-plugin-synthetic-packages",
"@kbn/babel-preset": "link:bazel-bin/packages/kbn-babel-preset",
"@kbn/bazel-packages": "link:bazel-bin/packages/kbn-bazel-packages",
"@kbn/ci-stats-client": "link:bazel-bin/packages/kbn-ci-stats-client",
"@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-utils": "link:bazel-bin/packages/kbn-dev-utils",
"@kbn/docs-utils": "link:bazel-bin/packages/kbn-docs-utils",
Expand All @@ -490,17 +493,21 @@
"@kbn/find-used-node-modules": "link:bazel-bin/packages/kbn-find-used-node-modules",
"@kbn/generate": "link:bazel-bin/packages/kbn-generate",
"@kbn/import-resolver": "link:bazel-bin/packages/kbn-import-resolver",
"@kbn/jest-serializers": "link:bazel-bin/packages/kbn-jest-serializers",
"@kbn/optimizer": "link:bazel-bin/packages/kbn-optimizer",
"@kbn/plugin-generator": "link:bazel-bin/packages/kbn-plugin-generator",
"@kbn/plugin-helpers": "link:bazel-bin/packages/kbn-plugin-helpers",
"@kbn/pm": "link:packages/kbn-pm",
"@kbn/sort-package-json": "link:bazel-bin/packages/kbn-sort-package-json",
"@kbn/spec-to-console": "link:bazel-bin/packages/kbn-spec-to-console",
"@kbn/stdio-dev-helpers": "link:bazel-bin/packages/kbn-stdio-dev-helpers",
"@kbn/storybook": "link:bazel-bin/packages/kbn-storybook",
"@kbn/synthetic-package-map": "link:bazel-bin/packages/kbn-synthetic-package-map",
"@kbn/telemetry-tools": "link:bazel-bin/packages/kbn-telemetry-tools",
"@kbn/test": "link:bazel-bin/packages/kbn-test",
"@kbn/test-jest-helpers": "link:bazel-bin/packages/kbn-test-jest-helpers",
"@kbn/test-subj-selector": "link:bazel-bin/packages/kbn-test-subj-selector",
"@kbn/tooling-log": "link:bazel-bin/packages/kbn-tooling-log",
"@kbn/type-summarizer": "link:bazel-bin/packages/kbn-type-summarizer",
"@loaders.gl/polyfills": "^2.3.5",
"@mapbox/vector-tile": "1.3.1",
Expand Down Expand Up @@ -599,6 +606,9 @@
"@types/kbn__apm-utils": "link:bazel-bin/packages/kbn-apm-utils/npm_module_types",
"@types/kbn__axe-config": "link:bazel-bin/packages/kbn-axe-config/npm_module_types",
"@types/kbn__bazel-packages": "link:bazel-bin/packages/kbn-bazel-packages/npm_module_types",
"@types/kbn__ci-stats-client": "link:bazel-bin/packages/kbn-ci-stats-client/npm_module_types",
"@types/kbn__ci-stats-config": "link:bazel-bin/packages/kbn-ci-stats-core/npm_module_types",
"@types/kbn__ci-stats-reporter": "link:bazel-bin/packages/kbn-ci-stats-reporter/npm_module_types",
"@types/kbn__cli-dev-mode": "link:bazel-bin/packages/kbn-cli-dev-mode/npm_module_types",
"@types/kbn__coloring": "link:bazel-bin/packages/kbn-coloring/npm_module_types",
"@types/kbn__config": "link:bazel-bin/packages/kbn-config/npm_module_types",
Expand All @@ -619,6 +629,7 @@
"@types/kbn__import-resolver": "link:bazel-bin/packages/kbn-import-resolver/npm_module_types",
"@types/kbn__interpreter": "link:bazel-bin/packages/kbn-interpreter/npm_module_types",
"@types/kbn__io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils/npm_module_types",
"@types/kbn__jest-serializers": "link:bazel-bin/packages/kbn-jest-serializers/npm_module_types",
"@types/kbn__logging": "link:bazel-bin/packages/kbn-logging/npm_module_types",
"@types/kbn__logging-mocks": "link:bazel-bin/packages/kbn-logging-mocks/npm_module_types",
"@types/kbn__mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl/npm_module_types",
Expand Down Expand Up @@ -650,11 +661,14 @@
"@types/kbn__shared-ux-services": "link:bazel-bin/packages/kbn-shared-ux-services/npm_module_types",
"@types/kbn__shared-ux-storybook": "link:bazel-bin/packages/kbn-shared-ux-storybook/npm_module_types",
"@types/kbn__shared-ux-utility": "link:bazel-bin/packages/kbn-shared-ux-utility/npm_module_types",
"@types/kbn__sort-package-json": "link:bazel-bin/packages/kbn-sort-package-json/npm_module_types",
"@types/kbn__std": "link:bazel-bin/packages/kbn-std/npm_module_types",
"@types/kbn__stdio-dev-helpers": "link:bazel-bin/packages/kbn-stdio-dev-helpers/npm_module_types",
"@types/kbn__storybook": "link:bazel-bin/packages/kbn-storybook/npm_module_types",
"@types/kbn__telemetry-tools": "link:bazel-bin/packages/kbn-telemetry-tools/npm_module_types",
"@types/kbn__test": "link:bazel-bin/packages/kbn-test/npm_module_types",
"@types/kbn__test-jest-helpers": "link:bazel-bin/packages/kbn-test-jest-helpers/npm_module_types",
"@types/kbn__tooling-log": "link:bazel-bin/packages/kbn-tooling-log/npm_module_types",
"@types/kbn__typed-react-router-config": "link:bazel-bin/packages/kbn-typed-react-router-config/npm_module_types",
"@types/kbn__ui-shared-deps-npm": "link:bazel-bin/packages/kbn-ui-shared-deps-npm/npm_module_types",
"@types/kbn__ui-shared-deps-src": "link:bazel-bin/packages/kbn-ui-shared-deps-src/npm_module_types",
Expand Down
14 changes: 14 additions & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ filegroup(
"//packages/kbn-babel-plugin-synthetic-packages:build",
"//packages/kbn-babel-preset:build",
"//packages/kbn-bazel-packages:build",
"//packages/kbn-ci-stats-client:build",
"//packages/kbn-ci-stats-core:build",
"//packages/kbn-ci-stats-reporter:build",
"//packages/kbn-cli-dev-mode:build",
"//packages/kbn-coloring:build",
"//packages/kbn-config-schema:build",
Expand All @@ -48,6 +51,7 @@ filegroup(
"//packages/kbn-import-resolver:build",
"//packages/kbn-interpreter:build",
"//packages/kbn-io-ts-utils:build",
"//packages/kbn-jest-serializers:build",
"//packages/kbn-logging-mocks:build",
"//packages/kbn-logging:build",
"//packages/kbn-mapbox-gl:build",
Expand Down Expand Up @@ -78,8 +82,10 @@ filegroup(
"//packages/kbn-shared-ux-services:build",
"//packages/kbn-shared-ux-storybook:build",
"//packages/kbn-shared-ux-utility:build",
"//packages/kbn-sort-package-json:build",
"//packages/kbn-spec-to-console:build",
"//packages/kbn-std:build",
"//packages/kbn-stdio-dev-helpers:build",
"//packages/kbn-storybook:build",
"//packages/kbn-synthetic-package-map:build",
"//packages/kbn-telemetry-tools:build",
Expand All @@ -88,6 +94,7 @@ filegroup(
"//packages/kbn-test:build",
"//packages/kbn-timelion-grammar:build",
"//packages/kbn-tinymath:build",
"//packages/kbn-tooling-log:build",
"//packages/kbn-type-summarizer:build",
"//packages/kbn-typed-react-router-config:build",
"//packages/kbn-ui-framework:build",
Expand All @@ -114,6 +121,9 @@ filegroup(
"//packages/kbn-apm-utils:build_types",
"//packages/kbn-axe-config:build_types",
"//packages/kbn-bazel-packages:build_types",
"//packages/kbn-ci-stats-client:build_types",
"//packages/kbn-ci-stats-core:build_types",
"//packages/kbn-ci-stats-reporter:build_types",
"//packages/kbn-cli-dev-mode:build_types",
"//packages/kbn-coloring:build_types",
"//packages/kbn-config-schema:build_types",
Expand All @@ -134,6 +144,7 @@ filegroup(
"//packages/kbn-import-resolver:build_types",
"//packages/kbn-interpreter:build_types",
"//packages/kbn-io-ts-utils:build_types",
"//packages/kbn-jest-serializers:build_types",
"//packages/kbn-logging-mocks:build_types",
"//packages/kbn-logging:build_types",
"//packages/kbn-mapbox-gl:build_types",
Expand Down Expand Up @@ -164,11 +175,14 @@ filegroup(
"//packages/kbn-shared-ux-services:build_types",
"//packages/kbn-shared-ux-storybook:build_types",
"//packages/kbn-shared-ux-utility:build_types",
"//packages/kbn-sort-package-json:build_types",
"//packages/kbn-std:build_types",
"//packages/kbn-stdio-dev-helpers:build_types",
"//packages/kbn-storybook:build_types",
"//packages/kbn-telemetry-tools:build_types",
"//packages/kbn-test-jest-helpers:build_types",
"//packages/kbn-test:build_types",
"//packages/kbn-tooling-log:build_types",
"//packages/kbn-type-summarizer:build_types",
"//packages/kbn-typed-react-router-config:build_types",
"//packages/kbn-ui-shared-deps-npm:build_types",
Expand Down
91 changes: 91 additions & 0 deletions packages/elastic-eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,97 @@ module.exports = {
],
],

/**
* ESLint rule to aid with breaking up packages:
*
* `fromPacakge` the package name which was broken up
* `toPackage` the package where the removed exports were placed
* `exportNames` the list of exports which used to be found in `fromPacakge` and are now found in `toPackage`
*
* TODO(@spalger): once packages have types we should be able to filter this rule based on the package type
* of the file being linted so that we could re-route imports from `plugin-client` types to a different package
* than `plugin-server` types.
*/
'@kbn/imports/exports_moved_packages': ['error', [
{
fromPackage: '@kbn/dev-utils',
toPackage: '@kbn/tooling-log',
exportNames: [
'DEFAULT_LOG_LEVEL',
'getLogLevelFlagsHelp',
'LOG_LEVEL_FLAGS',
'LogLevel',
'Message',
'ParsedLogLevel',
'parseLogLevel',
'pickLevelFromFlags',
'ToolingLog',
'ToolingLogCollectingWriter',
'ToolingLogOptions',
'ToolingLogTextWriter',
'ToolingLogTextWriterConfig',
'Writer',
]
},
{
fromPackage: '@kbn/dev-utils',
toPackage: '@kbn/ci-stats-reporter',
exportNames: [
'CiStatsMetric',
'CiStatsReporter',
'CiStatsReportTestsOptions',
'CiStatsTestGroupInfo',
'CiStatsTestResult',
'CiStatsTestRun',
'CiStatsTestType',
'CiStatsTiming',
'getTimeReporter',
'MetricsOptions',
'TimingsOptions',
]
},
{
fromPackage: '@kbn/dev-utils',
toPackage: '@kbn/ci-stats-core',
exportNames: [
'Config',
]
},
{
fromPackage: '@kbn/dev-utils',
toPackage: '@kbn/ci-stats-client',
exportNames: [
'CiStatsClient',
]
},
{
fromPackage: '@kbn/dev-utils',
toPackage: '@kbn/jest-serializers',
exportNames: [
'createAbsolutePathSerializer',
'createStripAnsiSerializer',
'createRecursiveSerializer',
'createAnyInstanceSerializer',
'createReplaceSerializer',
]
},
{
fromPackage: '@kbn/dev-utils',
toPackage: '@kbn/stdio-dev-helpers',
exportNames: [
'observeReadable',
'observeLines',
]
},
{
fromPackage: '@kbn/dev-utils',
toPackage: '@kbn/sort-package-json',
exportNames: [
'sortPackageJson',
]
},
]],

'@kbn/eslint/no_async_promise_body': 'error',
'@kbn/eslint/no_async_foreach': 'error',
'@kbn/eslint/no_trailing_import_slash': 'error',
Expand Down
120 changes: 120 additions & 0 deletions packages/kbn-ci-stats-client/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
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-ci-stats-client"
PKG_REQUIRE_NAME = "@kbn/ci-stats-client"

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//axios",
"//packages/kbn-ci-stats-core",
"//packages/kbn-tooling-log",
]

# 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//axios",
"//packages/kbn-ci-stats-core:npm_module_types",
"//packages/kbn-tooling-log: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"],
)
3 changes: 3 additions & 0 deletions packages/kbn-ci-stats-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/ci-stats-client

Empty package generated by @kbn/generate
13 changes: 13 additions & 0 deletions packages/kbn-ci-stats-client/jest.config.js
Original file line number Diff line number Diff line change
@@ -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-ci-stats-client'],
};
10 changes: 10 additions & 0 deletions packages/kbn-ci-stats-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@kbn/ci-stats-client",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0",
"kibana": {
"devOnly": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
*/

import Axios from 'axios';
import { ToolingLog } from '../tooling_log';
import { ToolingLog } from '@kbn/tooling-log';

import { parseConfig, Config } from './ci_stats_config';
import { CiStatsMetadata } from './ci_stats_metadata';
import { parseConfig, Config, CiStatsMetadata } from '@kbn/ci-stats-core';

interface LatestTestGroupStatsOptions {
/** The Kibana branch to get stats for, eg "main" */
Expand Down
Loading