2014-06-18 19:35:37 +02:00
|
|
|
module.exports = function (grunt) {
|
|
|
|
var config = {
|
|
|
|
build: {
|
|
|
|
options: {
|
2014-08-26 02:55:32 +02:00
|
|
|
appDir: '<%= build %>/src',
|
|
|
|
dir: '<%= build %>/kibana/public',
|
|
|
|
mainConfigFile: '<%= build %>/src/require.config.js',
|
2014-06-18 19:35:37 +02:00
|
|
|
modules: [
|
|
|
|
{
|
|
|
|
name: 'kibana',
|
|
|
|
excludeShallow: [
|
|
|
|
'../config',
|
2014-08-26 02:55:32 +02:00
|
|
|
'text!config'
|
2014-06-18 19:35:37 +02:00
|
|
|
],
|
2014-12-03 17:42:46 +01:00
|
|
|
include: []
|
2014-06-18 19:35:37 +02:00
|
|
|
}
|
|
|
|
],
|
|
|
|
|
|
|
|
optimize: 'none',
|
|
|
|
optimizeCss: 'none',
|
|
|
|
optimizeAllPluginResources: false,
|
|
|
|
|
|
|
|
removeCombined: true,
|
|
|
|
findNestedDependencies: true,
|
|
|
|
normalizeDirDefines: 'all',
|
|
|
|
inlineText: true,
|
|
|
|
skipPragmas: true,
|
|
|
|
|
|
|
|
done: function (done, output) {
|
|
|
|
var analysis = require('rjs-build-analysis');
|
|
|
|
var tree = analysis.parse(output);
|
|
|
|
var duplicates = analysis.duplicates(tree);
|
|
|
|
|
|
|
|
if (duplicates.length > 0) {
|
|
|
|
grunt.log.subhead('Duplicates found in requirejs build:');
|
|
|
|
grunt.log.warn(duplicates);
|
|
|
|
return done(new Error('r.js built duplicate modules, please check the excludes option.'));
|
|
|
|
} else {
|
|
|
|
var relative = [];
|
|
|
|
var bundles = tree.bundles || [];
|
|
|
|
bundles.forEach(function (bundle) {
|
|
|
|
bundle.children.forEach(function (child) {
|
2014-06-20 21:27:41 +02:00
|
|
|
if (child.match(/\.\//)) relative.push(child + ' is relative to ' + bundle.parent);
|
2014-06-18 19:35:37 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if (relative.length) {
|
|
|
|
grunt.log.subhead('Relative modules found in requirejs build:');
|
|
|
|
grunt.log.warn(relative);
|
|
|
|
return done(new Error('r.js build contains relative modules, duplicates probably exist'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
done();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-10-17 21:26:02 +02:00
|
|
|
// include bundled plugins in the build
|
2014-06-18 19:35:37 +02:00
|
|
|
var main = config.build.options.modules[0];
|
2014-10-18 01:23:07 +02:00
|
|
|
grunt.bundledPluginModuleIds.forEach(function (moduleId) {
|
|
|
|
main.include.push(moduleId);
|
2014-10-15 02:07:04 +02:00
|
|
|
});
|
2014-06-18 19:35:37 +02:00
|
|
|
|
|
|
|
return config;
|
2014-08-26 02:55:32 +02:00
|
|
|
};
|