Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new --run-examples flag #52031

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/cli/serve/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
set('plugins.paths', _.compact([].concat(
get('plugins.paths'),
opts.pluginPath,
opts.runExamples ? [
// Ideally this would automatically include all plugins in a top level examples dir.
// I do not include all plugins inside plugin functional since they are not all well
// built for examples, but just for testing purposes. I think there should be a
// distinction. The examples should be useable even without the bootstrapping of
// the test enviornment, loading up es_archived data, for example.
fromRoot('test/plugin_functional/plugins/demo_search'),
fromRoot('test/plugin_functional/plugins/search_explorer'),
] : [],

XPACK_INSTALLED && !opts.oss
? [XPACK_DIR]
Expand Down Expand Up @@ -200,7 +209,8 @@ export default function (program) {

if (!IS_KIBANA_DISTRIBUTABLE) {
command
.option('--oss', 'Start Kibana without X-Pack');
.option('--oss', 'Start Kibana without X-Pack')
.option('--run-examples', 'Adds plugin paths for all the Kibana example plugins and runs with no base path');
}

if (CAN_CLUSTER) {
Expand Down Expand Up @@ -237,7 +247,7 @@ export default function (program) {
silent: !!opts.silent,
watch: !!opts.watch,
repl: !!opts.repl,
basePath: !!opts.basePath,
basePath: opts.runExamples ? false : !!opts.basePath,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason to use no base path here is that we can use links into our examples in our api documentation, much like we have the View in Console links, that links to http://localhost:5601/kibana/demoSearch/.... We can link to these samples with a note that says, "be sure to running a local kibana with the --run-examples flag"

optimize: !!opts.optimize,
oss: !!opts.oss
},
Expand Down