kibana/Gruntfile.js
Richard Hoffman 8b4c052889 babel 6 upgrade (#9702)
* [npm] upgrade babel

The upgrade to babel 6 requires an upgrade to all of the associated modules, which meant that a few other things changed at the same time. The most notable is the way that we handle our babel-options, which is now done with an npm module and includes using the babel-loader's "presets" query string param.

This meant changes to the babel_options.js module and extending it to help setting up the "babel-register" module, which was previously copy-pasted in several places.

* [mtodules] upgrade to support babel6 module semantics

* [eslint] fix lint errors

* [babel] ignoer massive fixture files

* [cli/errors] use Object.setPrototypeOf since subclassing Error is broken

* [babel] Upgrading core babel libraries

[babel] Use WIP babel-6-fix branch of babel-preset-kibana

* Fix broken test

* [babel] Reverse unnecessary module.exports changes

* Fix notifier

* Use babel presets and plugins directly

* [babel/options] resolve preset/plugins paths for better plugin compatibility

* [babel/options] use babel-preset-env for correct node settings

* [babel] cache babel compilation in webpack like we thought we were
2017-02-09 14:48:55 -07:00

69 lines
2.2 KiB
JavaScript

const camelCase = require('lodash').camelCase;
require('./src/optimize/babel/register');
module.exports = function (grunt) {
// set the config once before calling load-grunt-config
// and once during so that we have access to it via
// grunt.config.get() within the config files
const config = {
pkg: grunt.file.readJSON('package.json'),
root: __dirname,
src: __dirname + '/src',
buildDir: __dirname + '/build', // temporary build directory
plugins: __dirname + '/src/core_plugins',
server: __dirname + '/src/server',
target: __dirname + '/target', // location of the compressed build targets
testUtilsDir: __dirname + '/src/test_utils',
configFile: __dirname + '/src/config/kibana.yml',
karmaBrowser: (function () {
if (grunt.option('browser')) {
return grunt.option('browser');
}
switch (require('os').platform()) {
case 'win32':
return 'IE';
default:
return 'Chrome';
}
}()),
nodeVersion: grunt.file.read('.node-version').trim(),
meta: {
banner: '/*! <%= package.name %> - v<%= package.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= package.homepage ? " * " + package.homepage + "\\n" : "" %>' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= package.author.company %>;' +
' Licensed <%= package.license %> */\n'
},
};
grunt.config.merge(config);
// must run before even services/platforms
grunt.config.set('build', require('./tasks/config/build')(grunt));
config.packageScriptsDir = __dirname + '/tasks/build/package_scripts';
// ensure that these run first, other configs need them
config.services = require('./tasks/config/services')(grunt);
config.platforms = require('./tasks/config/platforms')(grunt);
grunt.config.merge(config);
// load plugins
require('load-grunt-config')(grunt, {
configPath: __dirname + '/tasks/config',
init: true,
config: config,
loadGruntTasks: {
pattern: ['grunt-*', '@*/grunt-*', 'gruntify-*', '@*/gruntify-*', 'intern']
}
});
// load task definitions
grunt.task.loadTasks('tasks');
grunt.task.loadTasks('tasks/build');
};