kibana/tasks/bootstrap_kibana.js
Kim Joar Bekkelund 96d8995315
Build multiple Kibana packages for production (#16313) (#16496)
* Build packages before running ESLint on CI

* Add production task to kbn-build

* Ensure packages are bootstrapped before running the build

* Run ESLint on kbn-build
2018-02-02 22:47:18 +01:00

43 lines
868 B
JavaScript

module.exports = grunt => {
grunt.registerTask(
'bootstrapKibana',
'Bootstrap Kibana and all Kibana packages',
async function () {
const done = this.async();
try {
await bootstrapKibana();
done();
} catch (e) {
grunt.fail.fatal(e);
done(e);
}
}
);
function bootstrapKibana() {
const serverCmd = {
cmd: 'yarn',
args: [
'kbn',
'bootstrap',
'--skip-kibana-extra'
],
opts: {
stdio: 'inherit'
}
};
return new Promise((resolve, reject) => {
grunt.util.spawn(serverCmd, (error, result, code) => {
if (error || code !== 0) {
const error = new Error(`'yarn kbn bootstrap' exited with code ${code}`);
reject(error);
return;
}
resolve();
});
});
}
};