kibana/packages
Rudolf Meijering 85c8232c0b
Move KibanaMigrator into Server SavedObjectsService (#43433)
* Rename SavedObjectsService -> SavedObjectsLegacyService

* Expose legacy pluginSpecs from Core LegacyService

* Expose legacy uiExports from Core LegacyService

* Move kibana config to NP

* Expose pluginExtendedConfig from LegacyService

* Make KibanaMigrator NP compatible

* KibanaMigrator -> NP SavedObjectsService

* SavedObjectsService never stop retrying ES connection error

* Move waiting for migrations to complete till after legacy service start

* Fix ESArchiver's KibanaMigrator

* Fix reload logging config tests

* Run migrations on savedobjects start

* Fix env tests

* Fix and make legacy tests more robust/isolated

* Cleanup code

* Fix invalid config test

* Fix SavedObject Migrations logging test

* SavedObjectsService tests

* Lifecycle logging and improve getting kibanaConfig instance

* Fix awaitMigration bug and test

* Fix typing error

* Review comments

* Remove unecessary KibanaConfig class

* Move legacy plugin config extension, specs, uiExports entirely into Core

uiExports, specs, disabledSpecs, config now get injected into KbnServer

* Fix config deprecation test

* Use existing logger mock

* Create SavedObjectsConfig for migration config

* Define KibanaMigratorContract type

* KibanaMigratorContract -> IKibanaMigrator + docs improvements

* Fix esArchiver's KibanaMigrator

* Fix plugin generator integration test

* ConfigServiceContract -> IConfigService

* Address review comments

* Review nits

* Document migrations.skip config

* Review comments continued...

* awaitMigrations -> runMigrations

* Type improvements
2019-10-01 09:11:33 +02:00
..
elastic-datemath [mocha] fix test selectors to get everything in packages (#43797) 2019-08-22 18:49:01 -07:00
eslint-config-kibana Update mocha related packages (major) (#43915) 2019-10-01 00:07:13 -07:00
kbn-analytics [@kbn/analytics] Updates dependencies and browser entry (#44316) 2019-08-29 10:43:36 -07:00
kbn-babel-code-parser Update babel related packages (#43595) 2019-08-22 18:40:57 -07:00
kbn-babel-preset manually setup module transforms so to support async imports in webpack (#44413) 2019-08-29 14:04:12 -07:00
kbn-config-schema Apply all validation rules to empty strings (#46167) 2019-09-25 10:23:51 -05:00
kbn-dev-utils [dev-utils] implement basic KbnClient util for talking to Kiba… (#46673) 2019-09-30 22:52:07 -07:00
kbn-elastic-idx Update jest related packages (#46391) 2019-09-25 12:00:33 -07:00
kbn-es [kbn-es] make custom snapshot url a feature (#45750) 2019-09-15 08:10:43 -07:00
kbn-es-query Convert filter_manager/lib to TypeScript / Jest (#45785) 2019-09-27 15:22:29 +03:00
kbn-eslint-import-resolver-kibana Update dependency lru-cache to ^4.1.5 (#45157) 2019-09-09 13:33:31 -07:00
kbn-eslint-plugin-eslint Update dependency babel-eslint to ^10.0.3 (#44029) 2019-08-27 13:57:15 -07:00
kbn-expect Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
kbn-i18n Update jest related packages (#46391) 2019-09-25 12:00:33 -07:00
kbn-interpreter New visualization editor Lens (#36437) 2019-09-17 14:57:53 -04:00
kbn-plugin-generator Move KibanaMigrator into Server SavedObjectsService (#43433) 2019-10-01 09:11:33 +02:00
kbn-plugin-helpers Update dependency vinyl-fs to ^3.0.3 (#46652) 2019-09-26 12:45:01 -07:00
kbn-pm Update dependency @types/ora to ^1.3.5 (#46649) 2019-09-26 12:47:29 -07:00
kbn-spec-to-console Update jest related packages (#46391) 2019-09-25 12:00:33 -07:00
kbn-test Update mocha related packages (major) (#43915) 2019-10-01 00:07:13 -07:00
kbn-test-subj-selector Change data-test-subj selector logic to support value with spaces (#43682) 2019-09-12 09:48:09 +02:00
kbn-ui-framework Update dependency highlight.js to v9.15.10 (#45156) 2019-09-09 13:30:08 -07:00
kbn-utility-types Utility types (#41246) 2019-08-12 15:45:32 +02:00
README.md [test] remove x-pack mocha configuration (#42979) 2019-08-15 12:21:42 -05: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 are two patterns used to test packages, one using Mocha and one using Jest. These patterns emerged out of convention and we'd like to make them more similar to each other in the near future.

1. Mocha

Today a package can follow the pattern of having a __tests__ directory in each source code directory of a package which contains the tests for that module. These are usually run by Mocha.

If a package's tests should be run with Mocha, you'll have to opt-in to run them by appending the package's test file pattern(s) to Kibana's src/dev/mocha/run_mocha_cli.js file. These will then be run by the unit test runner.

  • yarn test or yarn grunt test runs all unit tests.
  • node scripts/mocha runs all Mocha tests.

2. Jest

A package can also 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.
  • node scripts/jest runs all Jest tests in Kibana.

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.