kibana/packages/kbn-plugin-helpers
Tiago Costa 0eeaafa722
chore(NA): move into single pkg json (#80015)
* chore(NA): update gitignore to include first changes from moving into a single package.json

* chore(NA): update gitignore

* chore(NA): move all the dependencies into the single package.json and apply changes to bootstrap

* chore(NA): fix types problems after the single package json

* chore(NA): include code to find the dependencies used across the code

* chore(NA): introduce pure lockfile for install dependencies on build

* chore(NA): update clean task to not delete anything from xpack node_modules

* chore(NA): update gitignore to remove development temporary rules

* chore(NA): update notice file

* chore(NA): update jest snapshots

* chore(NA): fix whitelisted licenses to include a new specify form of an already included one

* chore(NA): remove check lockfile symlinks from child projects

* chore(NA): fix eslint and add missing declared deps on single pkg json

* chore(NA): correctly update notice

* chore(NA): fix failing jest test for storyshots.test.tsx

* chore(NA): fix cypress multi reporter path

* chore(NA): fix Project tests check

* chore(NA): fix problem with logic to detect used dependes on oss build

* chore(NA): include correct x-pack plugins dep discovery

* chore(NA): discover entries under dynamic requires on vis_type_timelion

* chore(NA): remove canvas

* test(NA): fix jest unit tests

* chore(NA): remove double react declaration from storyshot test file

* chore(NA): try removing isOSS check

* chore(NA): support for plugin development

* chore(NA): update logic to fix unit tests and typechecking

* chore(NA): support to run npm scripts in child kbn projects across all envs

* chore(NA): support github checks reporter on x-pack and remove cpy types as the package correctly provides them

* chore(NA): update cpy version

* chore(NA): include last kbn pm changes

* chore(NA): update style on build_production_projects.ts

* chore(NA): remove any cast fom telemetry opt in stats

* chore(NA): remove del and re-use rm -rf again

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-02 21:18:52 +00:00
..
src Adds @kbn/utils package (#76518) 2020-09-15 10:34:39 -07:00
package.json chore(NA): move into single pkg json (#80015) 2020-11-02 21:18:52 +00:00
README.md Remove karma (#73126) 2020-07-27 11:07:58 -07:00
tsconfig.json Introduce TS incremental builds & move src/test_utils to TS project (#76082) 2020-09-03 14:20:04 +02:00

@kbn/plugin-helpers

Just some helpers for kibana plugin devs.

Installation

To install the plugin helpers use yarn to link to the package from the Kibana project:

yarn add --dev link:../../kibana/packages/kbn-plugin-helpers

This will link the package from the repository into your plugin, but the plugin-helpers executable won't be available in your project until you run bootstrap again.

yarn kbn bootstrap

Usage

This simple CLI has several tasks that plugin devs can run from to easily debug, test, or package kibana plugins.

$ plugin-helpers help

  Usage: plugin-helpers [options] [command]

  Commands:

    start                       Start kibana and have it include this plugin
    build [options] [files...]  Build a distributable archive
    test                        Run the server and browser tests
    test:mocha [files...]      Run the server tests using mocha

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

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 start

Setting Description
includePlugins Intended to be used in a config file, an array of additional plugin paths to include, absolute or relative to the plugin root
* Any options/flags included will be passed unmodified to the Kibana binary

Settings for build

Setting Description
skipArchive Don't create the zip file, leave the build path alone
buildDestination Target path for the build output, absolute or relative to the plugin root
skipInstallDependencies Don't install dependencies defined in package.json into build output
buildVersion Version for the 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": "../../kibana/tsconfig.json",

  // tell the TypeScript compiler where to find your source files
  "include": [
    "server/**/*",
    "public/**/*"
  ]
}