## 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> |
||
---|---|---|
.. | ||
src | ||
index.ts | ||
jest.integration.config.js | ||
kibana.jsonc | ||
package.json | ||
README.md | ||
tsconfig.json |
@kbn/plugin-helpers
Just some helpers for kibana plugin devs.
Installation
You don't actually need to install the plugin helpers, they are automatically inherited from the Kibana project by building your plugin within the Kibana repo. To use the plugin helpers just create the needed npm scripts on your plugin's package.json
(as exemplified below) which
is already the case if you use the new node scripts/generate_plugin
script.
{
"scripts" : {
"build": "yarn plugin-helpers build",
"dev": "yarn plugin-helpers dev",
"plugin-helpers": "node ../../scripts/plugin_helpers",
"kbn": "node ../../scripts/kbn"
}
}
This will make it easier to execute the plugin-helpers
script from within your plugin repository.
yarn kbn bootstrap
Usage
This simple CLI has a build task that plugin devs can run from to easily package Kibana plugins.
Previously you could also use that tool to start and test your plugin. Currently you can run
your plugin along with Kibana running yarn start
in the Kibana repository root folder. Finally to test
your plugin you should now configure and use your own tools.
$ plugin-helpers help
Usage: plugin-helpers [command] [options]
Commands:
build
Copies files from the source into a zip archive that can be distributed for
installation into production Kibana installs. The archive includes the non-
development npm dependencies and builds itself using raw files in the source
directory so make sure they are clean/up to date. The resulting archive can
be found at:
build/{plugin.id}-{kibanaVersion}.zip
Options:
--skip-archive Don't create the zip file, just create the build/kibana directory
--kibana-version, -v Kibana version this plugin will be built for
dev
Builds the current plugin ui browser side so it can be picked up by Kibana
during development.
Options:
--dist, -d Outputs bundles in dist mode instead
--watch, -w Starts the watch mode
Global options:
--verbose, -v Log verbosely
--debug Log debug messages (less than verbose)
--quiet Only log errors
--silent Don't log anything
--help Show this message
Versions
The plugins helpers in the Kibana repo are available for Kibana 6.3 and greater. Just checkout the branch of Kibana you want to build against and the plugin helpers should be up to date for that version of Kibana.
When you're targeting versions before Kibana 6.3, use the @elastic/plugin-helpers
from npm. See the versions section of the @elastic/plugin-helpers
readme for information about version compatibility.
Configuration
plugin-helpers
accepts a number of settings, which can be specified at runtime, or included in a .kibana-plugin-helpers.json
file if you'd like to bundle those settings with your project.
It will also observe a .kibana-plugin-helpers.dev.json
, much like Kibana does, which we encourage you to add to your .gitignore
file and use for local settings that you don't intend to share. These "dev" settings will override any settings in the normal json config.
All configuration setting listed below can simply can be included in the json config files. If you intend to inline the command, you will need to convert the setting to snake case (ie. skipArchive
becomes --skip-archive
).
Global settings
Settings for build
Setting | Description |
---|---|
serverSourcePatterns |
Defines the files that are built with babel and written to your distributable for your server plugin. It is ignored if kibana.json has none server: true setting defined. |
skipArchive |
Don't create the zip file, leave the build path alone |
skipInstallDependencies |
Don't install dependencies defined in package.json into build output |
kibanaVersion |
Kibana version for the build output (added to package.json) |
TypeScript support
Plugin code can be written in TypeScript if desired. To enable TypeScript support create a tsconfig.json
file at the root of your plugin that looks something like this:
{
// extend Kibana's tsconfig, or use your own settings
"extends": "../../tsconfig.json",
// tell the TypeScript compiler where to find your source files
"include": [
"server/**/*",
"public/**/*"
]
}