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
|
|
|
],
|
|
|
|
include: [
|
|
|
|
'controllers/kibana'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// include each app
|
|
|
|
var main = config.build.options.modules[0];
|
2014-10-15 02:07:04 +02:00
|
|
|
var dirname = require('path').dirname;
|
|
|
|
grunt.file.expand({ cwd: '<%= plugins %>' }, '*/index.js').forEach(function (fileName) {
|
|
|
|
var pluginName = dirname(fileName);
|
|
|
|
main.include.push('plugins/' + pluginName + '/index');
|
|
|
|
});
|
2014-06-18 19:35:37 +02:00
|
|
|
|
|
|
|
return config;
|
2014-08-26 02:55:32 +02:00
|
|
|
};
|