kibana/packages/kbn-plugin-generator
Tiago Costa 50313f75f6
chore(NA): enable preserve symlinks for ts without breaking packages development (#95433)
* chore(NA): move elastic-datemath into a ts package

* chore(NA): finish elastic-datemath

* chore(NA): finish elastic-datemath

* chore(NA): source folder for elastic-datemath

* chore(NA): add source-maps ace, analytics, apm-config-loader and apm-utils packages

* chore(NA): add sourcemaps to packages on typescript

* chore(NA): move test fixtures within source

* chore(NA): correct exclusions on packages

* chore(NA): correct package.json on all packages

* chore(NA): correct package.json on all packages

* chore(NA): complete kbn pm

* chore(NA): default export on elastic-datemath

* chore(NA): include logs on kbn-logging

* chore(NA): update bundle ref module to last code used in the webpack upstream

* chore(NA): update bundle ref module to last code used in the webpack upstream - refactored

* chore(NA): remove override method for exportsArgument

* fix(NA): typechecking problems by use @internal at javascript import sources on kbn-test package

* fix(NA): typescript projects check

* fix(NA): run optimizer integration tests from source

* chore(NA): fix usage from target for kbn optimizer

* chore(NA): path on tsconfig

* chore(NA): move tsignore into ts-expect-error

* chore(NA): include souce maps on kbn cli dev

* chore(NA): include souce maps on kbn-crypto, kbn-server-http-tools and kbn-telemetry-tools

* chore(NA): add issue links into the ts-expect-error comments
2021-03-31 00:02:22 +01:00
..
scripts Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
src Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
template [plugin-helpers] improve 3rd party KP plugin support (#75019) 2020-08-27 14:56:48 -07:00
jest.config.js Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
package.json chore(NA): enable preserve symlinks for ts without breaking packages development (#95433) 2021-03-31 00:02:22 +01:00
README.md chore(NA): remove mocha junit ci integrations (#88129) 2021-01-15 21:17:25 +00:00
tsconfig.json chore(NA): enable preserve symlinks for ts without breaking packages development (#95433) 2021-03-31 00:02:22 +01:00

Kibana Plugin Generator

This package can be used to generate a Kibana plugin from the Kibana repo.

Setup

Before you can use this plugin generator you must setup your Kibana development environment. If you can successfully run yarn kbn bootstrap then you are ready to generate plugins!

Compatibility

The plugin generator became a part of the Kibana project as of Kibana 6.3. If you are targeting versions before Kibana 6.3 then use the Kibana plugin sao template.

If you are targeting Kibana 6.3 or greater then checkout the corresponding Kibana branch and run the plugin generator.

Quick Start

To target the current development version of Kibana just use the default master branch.

node scripts/generate_plugin --name my_plugin_name -y
# generates a plugin in `plugins/my_plugin_name`

To target 6.8, use the 6.8 branch.

git checkout 6.x
yarn kbn bootstrap # always bootstrap when switching branches
node scripts/generate_plugin --name my_plugin_name -y
# generates a plugin for Kibana 6.8 in `../kibana-extra/my_plugin_name`

The generate script supports a few flags; run it with the --help flag to learn more.

node scripts/generate_plugin --help

Updating

Since the Plugin Generator is now a part of the Kibana repo, when you update your local checkout of the Kibana repository and bootstrap everything should be up to date!

NOTE: These commands should be run from the Kibana repo, and upstream is our convention for the git remote that references https://github.com/elastic/kibana.git, unless you added this remote you might need to use origin.

git pull upstream master
yarn kbn bootstrap

Plugin Development Scripts

Generated plugins receive a handful of scripts that can be used during development. Those scripts are detailed in the README.md file in each newly generated plugin, and expose the scripts provided by the Kibana plugin helpers, but here is a quick reference in case you need it:

NOTE: The following scripts should be run from the generated plugin.

  • yarn kbn bootstrap

    Install dependencies and crosslink Kibana and all projects/plugins.

    IMPORTANT: Use this script instead of yarn to install dependencies when switching branches, and re-run it whenever your dependencies change.

  • yarn build

    Build a distributable archive of your plugin.

To start kibana run the following command from Kibana root.

  • yarn start

    Start kibana and it will automatically include this plugin. You can pass any arguments that you would normally send to bin/kibana

    yarn start --elasticsearch.hosts http://localhost:9220
    

For more information about any of these commands run yarn ${task} --help. For a full list of tasks run yarn run or take a look in the package.json file.