kibana/packages
Kibana Machine 528c29e217
[kbn/optimizer] rewrite bazel-out paths to source paths (#105154) (#105369)
Co-authored-by: spalger <spalger@users.noreply.github.com>

Co-authored-by: Spencer <email@spalger.com>
Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-07-12 20:22:58 -04:00
..
elastic-datemath
elastic-eslint-config-kibana Enable CSS-in-JS styling with emotion (#98157) (#105223) 2021-07-12 12:23:24 -04:00
elastic-safer-lodash-set
kbn-ace
kbn-analytics
kbn-apm-config-loader [apm-config-loader] refactor config loading (#104197) (#104565) 2021-07-07 00:06:37 +00:00
kbn-apm-utils
kbn-babel-code-parser
kbn-babel-preset Enable CSS-in-JS styling with emotion (#98157) (#105223) 2021-07-12 12:23:24 -04:00
kbn-cli-dev-mode chore(NA): moving @kbn/cli-dev-mode into bazel (#103067) (#103201) 2021-06-24 01:58:42 -04:00
kbn-common-utils
kbn-config
kbn-config-schema
kbn-crypto Enable CSS-in-JS styling with emotion (#98157) (#105223) 2021-07-12 12:23:24 -04:00
kbn-dev-utils Enable CSS-in-JS styling with emotion (#98157) (#105223) 2021-07-12 12:23:24 -04:00
kbn-docs-utils
kbn-es [migrations v2] Integration test for multi-node cluster. (#100957) (#103559) 2021-06-28 18:34:31 -04:00
kbn-es-archiver chore(NA): moving @kbn/es-archiver into bazel (#103770) (#103825) 2021-06-30 01:42:53 -04:00
kbn-eslint-import-resolver-kibana
kbn-eslint-plugin-eslint Enable CSS-in-JS styling with emotion (#98157) (#105223) 2021-07-12 12:23:24 -04:00
kbn-expect
kbn-i18n [Localization] Adds guidelines about markdown and long paragraphs (#104171) (#104193) 2021-07-01 15:38:54 -04:00
kbn-interpreter switching to peggy (#103169) (#103420) 2021-06-27 04:27:13 -04:00
kbn-io-ts-utils [APM] Support records in strict_keys_rt (#103391) (#103524) 2021-06-28 16:07:17 -04:00
kbn-legacy-logging
kbn-logging
kbn-mapbox-gl
kbn-monaco
kbn-optimizer [kbn/optimizer] rewrite bazel-out paths to source paths (#105154) (#105369) 2021-07-12 20:22:58 -04:00
kbn-plugin-generator
kbn-plugin-helpers [plugin-helpers] Fix dependency resolution (#104556) (#104721) 2021-07-07 15:46:00 -04:00
kbn-pm Add timeouts and setup enforcement for custom plugins statuses (#77965) (#103149) 2021-06-23 16:02:07 -04:00
kbn-rule-data-utils [7.x] [RAC] [RBAC] MVP RBAC for alerts as data (#100705) (#104976) 2021-07-09 16:20:12 -04:00
kbn-securitysolution-es-utils [7.x] [RAC] [RBAC] MVP RBAC for alerts as data (#100705) (#104976) 2021-07-09 16:20:12 -04:00
kbn-securitysolution-hook-utils
kbn-securitysolution-io-ts-alerting-types
kbn-securitysolution-io-ts-list-types
kbn-securitysolution-io-ts-types
kbn-securitysolution-io-ts-utils
kbn-securitysolution-list-api
kbn-securitysolution-list-constants
kbn-securitysolution-list-hooks
kbn-securitysolution-list-utils
kbn-securitysolution-t-grid [RAC] T-Grid is moving to a new home (#100265) (#103178) 2021-06-24 00:46:39 -04:00
kbn-securitysolution-utils
kbn-server-http-tools
kbn-server-route-repository
kbn-spec-to-console Console definitions for 7.14 (rework) (#103681) 2021-07-05 18:31:48 +02:00
kbn-std
kbn-storybook Enable CSS-in-JS styling with emotion (#98157) (#105223) 2021-07-12 12:23:24 -04:00
kbn-telemetry-tools Enable CSS-in-JS styling with emotion (#98157) (#105223) 2021-07-12 12:23:24 -04:00
kbn-test Enable CSS-in-JS styling with emotion (#98157) (#105223) 2021-07-12 12:23:24 -04:00
kbn-test-subj-selector chore(NA): moving @kbn/test-subj-selector into bazel (#103562) (#103668) 2021-06-29 12:18:13 -04:00
kbn-tinymath [Lens] Escape field names in formula (#102588) (#103153) 2021-06-25 21:24:28 +00:00
kbn-ui-framework
kbn-ui-shared-deps Enable CSS-in-JS styling with emotion (#98157) (#105223) 2021-07-12 12:23:24 -04:00
kbn-utility-types
kbn-utils [paths] Add default lookup for kibana.yml at /etc/kibana (#103934) (#105009) 2021-07-08 23:04:09 -04:00
BUILD.bazel chore(NA): moving @kbn/es-archiver into bazel (#103770) (#103825) 2021-06-30 01:42:53 -04:00
README.md

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 or yarn grunt 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.