- start in Kibana root (shown as "{root}/" throughout below)
yarn build -> scripts.build -> node scripts/build --all-platforms
- build script requires
'{root}/src/dev/build/cli'
- the cli file manages a bunch of initial CLI flags, then calls
buildDistributables()
buildDistributables
runs many build tasks, including theOptimizeBuildTask
- the optimize task runs the kibana binary with the optimize flag:
{root}/bin/kibana --env.name=production --logging.json=false --optimize
- the kibana binary checks that you have a node binary in
{root}/node/bin/node
, then invokes the{root}/src/cli
file - if there is no "subcommand" (concept from "commander" package, e.g. "bin/kibana something"), it will splice in the "serve" subcommand for you
- the "commander" package parses the CLI arguments and runs "serve", set up by the
serveCommand(program)
call serveCommand()
sets up the "serve" command- "serve" does a lot of configuration and option defaulting and management, then ultimately runs
bootstrap()
- the bootstrap method creates a new "Root" and calls its
start
method - the
Root
object creates a newServer
instance and assigns it tothis.server
, then theRoot#start
method callsthis.server.start
- the
Server
object creates a number of things on instantiation, one being aLegacyCompatModule
instance which it assigns tothis.legacy
- https://github.com/elastic/kibana/blob/master/src/core/server/index.ts#L45
- I believe this
LegacyCompatModule
is the "old platform"? PluginsModule
assigned tothis.plugins
might be the "new platform"?
- the
Server#start
method callsthis.legacy.service.start()
this.legacy.service
is aLegacyService
instance- the
LegacyService#start
method creates a newkbnServer
which requires in the{root}/src/server/kbn_server
file - the
KbnServer
constructor sets up a list of "mixins", or functions that will be called in order -- one is theOptimizeMixin
- mixins are each called with
this, this.server, this.config
- the
OptimizeMixin
handles watch mode etc., and creates a newFsOptimizer
FsOptimizer
extends from theBaseOptimizer
- the
BaseOptimizer
sets up webpack!
Last active
November 26, 2018 18:44
-
-
Save jasonrhodes/a6b7267ab8db24626bc6bdfa350975dc to your computer and use it in GitHub Desktop.
Schoolhouse Rock: How a Kibana becomes a build (specifically client-side webpack)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment