kibana/packages
Clint Andrew Hall d92b7feeff
[typescript] Create Ambient Types package (#129368)
* WIP

* tweak @kbn/ambient-ui-types for special usecase

* remove @types/ for ambient-ui-types, the package is a types package

* Split types; remove duplicate types in packages

* Adjust README

* Update CODEOWNERS

* Addressing feedback

* Move to tsconfig.base.json

* Fix missing types array in kbn/field-types

* Addressing errors

* Return declaration

* move storybook types to storybook specific package

* add codeowner for new package

Co-authored-by: spalger <spencer@elastic.co>
2022-04-06 19:21:24 -05:00
..
elastic-analytics Create @elastic/analytics package (#128407) 2022-04-05 08:21:57 -07:00
elastic-apm-synthtrace [APM] fix cypress (#128411) 2022-03-29 12:16:32 -07:00
elastic-datemath [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
elastic-eslint-config-kibana [eslint] ensure that all imports are resolvable (#129002) 2022-04-04 15:37:06 -04:00
elastic-safer-lodash-set chore(NA): splits types from code on @elastic/safer-lodash-set (#122697) 2022-01-12 19:10:36 +00:00
kbn-ace [type-summarizer] summarize types with source-maps for @kbn/ace (#127680) 2022-03-18 16:44:16 +01:00
kbn-alerts [type-summarizer] summarize @kbn/alerts types with source-maps (#128191) 2022-03-21 12:17:36 -07:00
kbn-ambient-storybook-types [typescript] Create Ambient Types package (#129368) 2022-04-06 19:21:24 -05:00
kbn-ambient-ui-types [typescript] Create Ambient Types package (#129368) 2022-04-06 19:21:24 -05:00
kbn-analytics [type-summarizer] enable @kbn/analytics, @kbn/apm-config-loader and @kbn/apm-utils (#128206) 2022-03-22 16:28:49 -06:00
kbn-apm-config-loader [type-summarizer] enable @kbn/analytics, @kbn/apm-config-loader and @kbn/apm-utils (#128206) 2022-03-22 16:28:49 -06:00
kbn-apm-utils [type-summarizer] enable @kbn/analytics, @kbn/apm-config-loader and @kbn/apm-utils (#128206) 2022-03-22 16:28:49 -06:00
kbn-axe-config [axe-config] extract module to it's own package (#128815) 2022-03-29 15:12:14 -07:00
kbn-babel-code-parser [eslint] automatically determine dev packages (#127089) 2022-03-08 07:42:06 -06:00
kbn-babel-preset [Unified search] Create unified search plugin (#127651) 2022-04-05 12:23:31 +05:00
kbn-bazel-packages [bazel/packages] make package discovery dirs easier to extend (#127836) 2022-03-16 08:57:29 -06:00
kbn-cli-dev-mode [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-config [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-config-schema [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-crypto [ts] enable sourcemaps in summarized types of @kbn/crypto (#126410) 2022-03-04 08:02:02 -06:00
kbn-dev-utils [toolingLog] when indent block is synchronous, dedent synchronously (#129269) 2022-04-04 08:53:08 -07:00
kbn-doc-links [Fleet] Encrypt ssl fields in logstash output (#129131) 2022-04-05 12:30:37 -07:00
kbn-docs-utils Fix deprecations being incorrectly counted (#128985) 2022-03-31 14:01:14 -04:00
kbn-es Extend yarn es: plugin support + adding secure files to es keystore (#126938) 2022-03-09 11:11:34 +01:00
kbn-es-archiver [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-es-query [eslint] ensure that all imports are resolvable (#129002) 2022-04-04 15:37:06 -04:00
kbn-eslint-plugin-eslint [eslint] ensure that all imports are resolvable (#129002) 2022-04-04 15:37:06 -04:00
kbn-eslint-plugin-imports [eslint] ensure that all imports are resolvable (#129002) 2022-04-04 15:37:06 -04:00
kbn-expect chore(NA): use internal pkg_npm on @kbn/expect (#120941) 2021-12-10 02:45:49 +00:00
kbn-field-types [typescript] Create Ambient Types package (#129368) 2022-04-06 19:21:24 -05:00
kbn-flot-charts Tweak Canvas plot renderer (#126862) 2022-03-04 10:00:03 -05:00
kbn-generate fix(NA): do not declare @types packages as prod dependencies when generating the pkg.json (#128805) 2022-03-29 14:12:19 -07:00
kbn-i18n [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-i18n-react Bump @testing-library (#128659) 2022-04-06 21:11:33 +02:00
kbn-interpreter [eslint] ensure that all imports are resolvable (#129002) 2022-04-04 15:37:06 -04:00
kbn-io-ts-utils [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-logging [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-logging-mocks [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-mapbox-gl [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-monaco [eslint] ensure that all imports are resolvable (#129002) 2022-04-04 15:37:06 -04:00
kbn-optimizer [Unified search] Create unified search plugin (#127651) 2022-04-05 12:23:31 +05:00
kbn-plugin-discovery [plugin-discovery] move logic to a package (#128684) 2022-03-29 13:19:58 -06:00
kbn-plugin-generator [eslint] automatically determine dev packages (#127089) 2022-03-08 07:42:06 -06:00
kbn-plugin-helpers [plugin-discovery] move logic to a package (#128684) 2022-03-29 13:19:58 -06:00
kbn-pm [eslint] ensure that all imports are resolvable (#129002) 2022-04-04 15:37:06 -04:00
kbn-react-field [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-rule-data-utils [Security Solution][Alerts] Replace schemas derived from FieldMaps with versioned alert schema (#127218) 2022-03-29 20:11:55 -07:00
kbn-securitysolution-autocomplete [Security Solution][Endpoint] Update warning text for event filter matches operator (#127958) 2022-03-17 13:10:28 -07:00
kbn-securitysolution-es-utils [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-hook-utils [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-io-ts-alerting-types [Response Ops] Renaming Alert to Rule (#129136) 2022-04-04 07:32:32 -04:00
kbn-securitysolution-io-ts-list-types Create generic get filter method to be used with an array of list id's (#127983) 2022-03-24 08:23:21 +01:00
kbn-securitysolution-io-ts-types [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-io-ts-utils [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-list-api Set filter to undefined when it's empty on findExceptionLists method (#128455) 2022-03-29 12:44:31 +02:00
kbn-securitysolution-list-constants [Security Solution] add blocklist list (#126390) 2022-03-01 09:46:13 -06:00
kbn-securitysolution-list-hooks Bump @testing-library (#128659) 2022-04-06 21:11:33 +02:00
kbn-securitysolution-list-utils [Security Solution] Consider exceptions when loading threshold alert timelines (#128495) 2022-03-29 15:09:55 -04:00
kbn-securitysolution-rules [Security Solution][Detections] Adds rule execution log table (#126215) 2022-03-28 16:42:46 -06:00
kbn-securitysolution-t-grid [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-securitysolution-utils [Security Solution] fix blocklist path validation (#129124) 2022-03-31 13:19:16 -07:00
kbn-server-http-tools [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-server-route-repository [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-shared-ux-components [typescript] Create Ambient Types package (#129368) 2022-04-06 19:21:24 -05:00
kbn-shared-ux-services [Telemetry] Move privacy statement URL to doc links (#126597) 2022-03-18 10:56:38 +01:00
kbn-shared-ux-storybook [typescript] Create Ambient Types package (#129368) 2022-04-06 19:21:24 -05:00
kbn-shared-ux-utility [sharedUX] Move to Package-based Architecture (#127546) 2022-03-16 17:13:58 -04:00
kbn-spec-to-console chore(NA): use internal pkg_npm on @kbn/spec-to-console (#121812) 2021-12-22 03:21:00 +00:00
kbn-std [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-storybook [typescript] Create Ambient Types package (#129368) 2022-04-06 19:21:24 -05:00
kbn-telemetry-tools chore(NA): upgrade typescript-eslint packages to v5.14.0 (#127275) 2022-03-10 22:44:06 +00:00
kbn-test [axe-config] extract module to it's own package (#128815) 2022-03-29 15:12:14 -07:00
kbn-test-jest-helpers [axe-config] extract module to it's own package (#128815) 2022-03-29 15:12:14 -07:00
kbn-test-subj-selector chore(NA): use internal pkg_npm on @kbn/test-subj-selector (#121839) 2021-12-22 14:00:50 -07:00
kbn-timelion-grammar [eslint] ensure that all imports are resolvable (#129002) 2022-04-04 15:37:06 -04:00
kbn-tinymath [eslint] ensure that all imports are resolvable (#129002) 2022-04-04 15:37:06 -04:00
kbn-type-summarizer [plugin-discovery] move logic to a package (#128684) 2022-03-29 13:19:58 -06:00
kbn-typed-react-router-config [APM] Improve error message for route matching (#126455) 2022-03-01 14:49:27 +01:00
kbn-ui-framework chore(NA): use internal pkg_npm on @kbn/ui-framework (#121922) 2021-12-23 02:53:36 +00:00
kbn-ui-shared-deps-npm [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-ui-shared-deps-src [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-ui-theme [bazel] avoid a little boilerplate in packages (#126309) 2022-02-24 12:43:12 -06:00
kbn-utility-types [eslint] automatically determine dev packages (#127089) 2022-03-08 07:42:06 -06:00
kbn-utils [eslint] ensure that all imports are resolvable (#129002) 2022-04-04 15:37:06 -04:00
BUILD.bazel [typescript] Create Ambient Types package (#129368) 2022-04-06 19:21:24 -05:00
README.md Remove grunt (#111882) 2021-09-16 15:24:42 -04:00

Kibana-related packages

This folder contains packages that are intended for use in Kibana and Kibana plugins.

tl;dr:

  • Don't publish to npm registry
  • Always use the @kbn namespace
  • Always set "private": true in package.json

Using these packages

We no longer publish these packages to the npm registry. Now, instead of specifying a version when including these packages, we rely on yarn workspaces, which sets up a symlink to the package.

For example if you want to use the @kbn/i18n package in Kibana itself, you can specify the dependency like this:

"@kbn/i18n": "1.0.0"

However, if you want to use this from a Kibana plugin, you need to use a link: dependency and account for the relative location of the Kibana repo, so it would instead be:

"@kbn/i18n": "link:../../kibana/packages/kbn-i18n"

How all of this works is described in more detail in the @kbn/pm docs.

Creating a new package

Create a new sub-folder. The name of the folder should mirror the name in the package's package.json. E.g. if the name is @kbn/i18n the folder name should be kbn-i18n.

All new packages should use the @kbn namespace, and should be marked with "private": true.

Unit tests for a package

Currently there is only one tool being used in order to test packages which is Jest. Below we will explain how it should be done.

Jest

A package should follow the pattern of having .test.js files as siblings of the source code files, and these run by Jest.

A package using the .test.js naming convention will have those tests automatically picked up by Jest and run by the unit test runner, currently mapped to the Kibana test script in the root package.json.

  • yarn test runs all unit tests.
  • yarn jest runs all Jest tests in Kibana.

In order for the plugin or package to use Jest, a jest.config.js file must be present in it's root. However, there are safeguards for this in CI should a test file be added without a corresponding config file.


Each package can also specify its own test script in the package's package.json, for cases where you'd prefer to run the tests from the local package directory.