## Summary This PR aims at relocating some of the Kibana modules (plugins and packages) into a new folder structure, according to the _Sustainable Kibana Architecture_ initiative. > [!IMPORTANT] > * We kindly ask you to: > * Manually fix the errors in the error section below (if there are any). > * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the source code (Babel and Eslint config files), and update them appropriately. > * Manually review `.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that any CI pipeline customizations continue to be correctly applied after the changed path names > * Review all of the updated files, specially the `.ts` and `.js` files listed in the sections below, as some of them contain relative paths that have been updated. > * Think of potential impact of the move, including tooling and configuration files that can be pointing to the relocated modules. E.g.: > * customised eslint rules > * docs pointing to source code > [!NOTE] > * This PR has been auto-generated. > * Any manual contributions will be lost if the 'relocate' script is re-run. > * Try to obtain the missing reviews / approvals before applying manual fixes, and/or keep your changes in a .patch / git stash. > * Please use [#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E) Slack channel for feedback. Are you trying to rebase this PR to solve merge conflicts? Please follow the steps describe [here](https://elastic.slack.com/archives/C07TCKTA22E/p1734019532879269?thread_ts=1734019339.935419&cid=C07TCKTA22E). #### 3 packages(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/code-editor` | `src/platform/packages/shared/shared-ux/code_editor/impl` | | `@kbn/code-editor-mock` | `src/platform/packages/shared/shared-ux/code_editor/mocks` | | `@kbn/monaco` | `src/platform/packages/shared/kbn-monaco` | <details > <summary>Updated relative paths</summary> ``` src/platform/packages/shared/kbn-monaco/jest.config.js:12 src/platform/packages/shared/kbn-monaco/tsconfig.json:2 src/platform/packages/shared/kbn-monaco/tsconfig.type_check.json:2 src/platform/packages/shared/shared-ux/code_editor/impl/jest.config.js:12 src/platform/packages/shared/shared-ux/code_editor/impl/tsconfig.json:16 src/platform/packages/shared/shared-ux/code_editor/impl/tsconfig.json:2 src/platform/packages/shared/shared-ux/code_editor/impl/tsconfig.type_check.json:18 src/platform/packages/shared/shared-ux/code_editor/impl/tsconfig.type_check.json:2 src/platform/packages/shared/shared-ux/code_editor/impl/tsconfig.type_check.json:25 src/platform/packages/shared/shared-ux/code_editor/impl/tsconfig.type_check.json:28 src/platform/packages/shared/shared-ux/code_editor/impl/tsconfig.type_check.json:31 src/platform/packages/shared/shared-ux/code_editor/impl/tsconfig.type_check.json:34 src/platform/packages/shared/shared-ux/code_editor/impl/tsconfig.type_check.json:37 src/platform/packages/shared/shared-ux/code_editor/impl/tsconfig.type_check.json:40 src/platform/packages/shared/shared-ux/code_editor/mocks/tsconfig.json:16 src/platform/packages/shared/shared-ux/code_editor/mocks/tsconfig.json:2 src/platform/packages/shared/shared-ux/code_editor/mocks/tsconfig.type_check.json:18 src/platform/packages/shared/shared-ux/code_editor/mocks/tsconfig.type_check.json:2 src/platform/packages/shared/shared-ux/code_editor/mocks/tsconfig.type_check.json:25 ``` </details> |
||
---|---|---|
.. | ||
content-management | ||
core | ||
deeplinks/shared | ||
home | ||
kbn-ambient-common-types | ||
kbn-ambient-ftr-types | ||
kbn-ambient-storybook-types | ||
kbn-ambient-ui-types | ||
kbn-apm-synthtrace | ||
kbn-apm-synthtrace-client | ||
kbn-axe-config | ||
kbn-babel-preset | ||
kbn-babel-register | ||
kbn-babel-transform | ||
kbn-bazel-runner | ||
kbn-calculate-auto | ||
kbn-capture-oas-snapshot-cli | ||
kbn-charts-theme | ||
kbn-check-mappings-update-cli | ||
kbn-check-prod-native-modules-cli | ||
kbn-ci-stats-core | ||
kbn-ci-stats-performance-metrics | ||
kbn-ci-stats-reporter | ||
kbn-ci-stats-shipper-cli | ||
kbn-cli-dev-mode | ||
kbn-code-owners | ||
kbn-cypress-config | ||
kbn-dependency-ownership | ||
kbn-dependency-usage | ||
kbn-dev-cli-errors | ||
kbn-dev-cli-runner | ||
kbn-dev-proc-runner | ||
kbn-dev-utils | ||
kbn-docs-utils | ||
kbn-es | ||
kbn-es-archiver | ||
kbn-eslint-config | ||
kbn-eslint-plugin-css | ||
kbn-eslint-plugin-disable | ||
kbn-eslint-plugin-eslint | ||
kbn-eslint-plugin-i18n | ||
kbn-eslint-plugin-imports | ||
kbn-eslint-plugin-telemetry | ||
kbn-expect | ||
kbn-failed-test-reporter-cli | ||
kbn-find-used-node-modules | ||
kbn-formatters | ||
kbn-ftr-common-functional-services | ||
kbn-ftr-common-functional-ui-services | ||
kbn-ftr-screenshot-filename | ||
kbn-gen-ai-functional-testing | ||
kbn-generate | ||
kbn-generate-console-definitions | ||
kbn-get-repo-files | ||
kbn-grid-layout | ||
kbn-guided-onboarding | ||
kbn-import-locator | ||
kbn-import-resolver | ||
kbn-io-ts-utils | ||
kbn-item-buffer | ||
kbn-jest-serializers | ||
kbn-journeys | ||
kbn-json-ast | ||
kbn-kibana-manifest-schema | ||
kbn-lint-packages-cli | ||
kbn-lint-ts-projects-cli | ||
kbn-managed-vscode-config | ||
kbn-managed-vscode-config-cli | ||
kbn-management | ||
kbn-manifest | ||
kbn-mock-idp-plugin | ||
kbn-mock-idp-utils | ||
kbn-openapi-bundler | ||
kbn-openapi-generator | ||
kbn-optimizer | ||
kbn-optimizer-webpack-helpers | ||
kbn-palettes | ||
kbn-peggy | ||
kbn-peggy-loader | ||
kbn-performance-testing-dataset-extractor | ||
kbn-picomatcher | ||
kbn-plugin-check | ||
kbn-plugin-generator | ||
kbn-plugin-helpers | ||
kbn-react-mute-legacy-root-warning | ||
kbn-relocate | ||
kbn-repo-file-maps | ||
kbn-repo-linter | ||
kbn-repo-path | ||
kbn-repo-source-classifier | ||
kbn-repo-source-classifier-cli | ||
kbn-saved-objects-settings | ||
kbn-saved-search-component | ||
kbn-scout | ||
kbn-scout-info | ||
kbn-scout-reporting | ||
kbn-set-map | ||
kbn-some-dev-log | ||
kbn-sort-package-json | ||
kbn-stdio-dev-helpers | ||
kbn-storybook | ||
kbn-styled-components-mapping-cli | ||
kbn-telemetry-tools | ||
kbn-test | ||
kbn-test-eui-helpers | ||
kbn-test-jest-helpers | ||
kbn-test-subj-selector | ||
kbn-tooling-log | ||
kbn-ts-projects | ||
kbn-ts-type-check-cli | ||
kbn-use-tracked-promise | ||
kbn-validate-next-docs-cli | ||
kbn-web-worker-stub | ||
kbn-whereis-pkg-cli | ||
kbn-yarn-lock-validator | ||
react | ||
response-ops | ||
serverless | ||
shared-ux | ||
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
inpackage.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/src/platform/packages/shared/kbn-i18n"
then run yarn kbn bootstrap
from the plugin directory.
Creating a new package
Run the following command from the root of the Kibana repo:
node scripts/generate package @kbn/<PACKAGE_NAME> --web --owner @elastic/<TEAM_NAME>
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.