elastic / template-kibana-plugin

sao.js template for kibana plugins
Apache License 2.0
64 stars 34 forks source link

Continuous development? #9

Closed gergely-ujvari closed 7 years ago

gergely-ujvari commented 7 years ago

Hello,

I have a brief question about the kibana plugins generated with this plugin generator. Can I run Kibana together with the generated plugin in a way that Kibana would monitor the source file changes in the generated plugin directory and automatically restart when a file changes?

If this is not the right place to ask my question, please tell me where should post this question.

Thank you for the help.

w33ble commented 7 years ago

Can I run Kibana together with the generated plugin in a way that Kibana would monitor the source file changes in the generated plugin directory and automatically restart when a file changes?

Yup, it's a big part of the value add for using the template. Once you have generated your plugin, the resulting package.json file comes with a bunch of scripts to help you out. One of scripts, start, will start Kibana with your plugin running as outlined in the readme. So from the plugin path, simply yarn start or npm start, whatever your preference, and it'll start Kibana in dev mode with your plugin running. The dev mode part is important; in this mode, Kibana will watch for changes in its code or any of the plugins code, and restart the server as needed (only when server files change, public changes are evaluated at load time, and simply require a browser refresh).

There are some limitations to this, in that a few of the files it will see change, but won't be able to correctly restart the server, and you'll have to manually kill and restart it. For example, if you add routes, exports, config values, of just about anything to the root index.js file, you'll need a hard restart. But these changes should be pretty rare once you get things bootstrapped, and you can get around the limitation by breaking settings out into new files. For example, to add server-side routes to you app, you do this in the init config, and at Elastic, it's common for us to make an external init.js file, require that, and plug that into the config. This is good enough to be able to add routes without a hard restart.

TL;DR - Just run npm start from the root of your plugin.

If this is not the right place to ask my question, please tell me where should post this question.

The Elastic Discuss Forums are meant for questions. As this is not actually an issue, I'm going to close this, but if you have further questions, following up here isn't a problem.