Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Check location of Kibana on postinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
kimjoar committed Dec 7, 2017
1 parent c12443d commit 497559d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,11 @@ program
});
}));

program
.command('postinstall')
.action(taskRunner(function (command) {
run('postinstall');
}));

program
.parse(process.argv);
2 changes: 2 additions & 0 deletions lib/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ const startTask = require('../tasks/start');
const testAllTask = require('../tasks/test/all');
const testBrowserTask = require('../tasks/test/browser');
const testServerTask = require('../tasks/test/server');
const postinstallTask = require('../tasks/postinstall');

module.exports = {
build: buildTask,
start: startTask,
testAll: testAllTask,
testBrowser: testBrowserTask,
testServer: testServerTask,
postinstall: postinstallTask
};
25 changes: 25 additions & 0 deletions tasks/postinstall/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const resolve = require('path').resolve;
const statSync = require('fs').statSync;

module.exports = function (plugin, run, options) {
if (
fileExists(resolve(plugin.root, '../kibana/package.json')) &&
!fileExists(resolve(plugin.root, '../../kibana/package.json'))
) {
process.stdout.write(
'\nWARNING: Kibana now requires that plugins must be located in ' +
'`../kibana-extra/{pluginName}` relative to the Kibana folder ' +
'during development. We found a Kibana in `../kibana`, but not in ' +
'`../../kibana`.\n'
)
}
};

function fileExists(path) {
try {
const stat = statSync(path);
return stat.isFile();
} catch (e) {
return false;
}
}

0 comments on commit 497559d

Please sign in to comment.