11import { cleanVersion , versionSatisfies } from '../../utils/version' ;
22import { get } from 'lodash' ;
33
4- function compatibleWithKibana ( kbnServer , pluginVersion ) {
4+ function compatibleWithKibana ( kbnServer , plugin ) {
55 //core plugins have a version of 'kibana' and are always compatible
6- if ( pluginVersion === 'kibana' ) return true ;
6+ if ( plugin . kibanaVersion === 'kibana' ) return true ;
77
8- const cleanPluginVersion = cleanVersion ( pluginVersion ) ;
8+ const pluginKibanaVersion = cleanVersion ( plugin . kibanaVersion ) ;
99 const kibanaVersion = cleanVersion ( kbnServer . version ) ;
1010
11- return versionSatisfies ( cleanPluginVersion , kibanaVersion ) ;
11+ return versionSatisfies ( pluginKibanaVersion , kibanaVersion ) ;
1212}
1313
1414export default async function ( kbnServer , server , config ) {
@@ -18,14 +18,10 @@ export default async function (kbnServer, server, config) {
1818 const plugins = kbnServer . plugins ;
1919
2020 for ( let plugin of plugins ) {
21- // Plugins must specify their version, and by default that version should match
22- // the version of kibana down to the patch level. If these two versions need
23- // to diverge, they can specify a kibana.version to indicate the version of
24- // kibana the plugin is intended to work with.
25- const version = get ( plugin , 'pkg.kibana.version' , get ( plugin , 'pkg.version' ) ) ;
21+ const version = plugin . kibanaVersion ;
2622 const name = get ( plugin , 'pkg.name' ) ;
2723
28- if ( ! compatibleWithKibana ( kbnServer , version ) ) {
24+ if ( ! compatibleWithKibana ( kbnServer , plugin ) ) {
2925 const message = `Plugin "${ name } " was disabled because it expected Kibana version "${ version } ", and found "${ kbnServer . version } ".` ;
3026 warningMessages . add ( message ) ;
3127 plugins . delete ( plugin ) ;
0 commit comments