grafana/tasks/build_task.js

72 lines
1.7 KiB
JavaScript
Raw Normal View History

2013-11-14 17:07:14 -06:00
module.exports = function(grunt) {
2015-01-04 10:51:48 -06:00
"use strict";
2013-11-14 17:07:14 -06:00
// Concat and Minify the src directory into dist
grunt.registerTask('build', [
'jshint:source',
'jshint:tests',
2015-03-03 03:20:52 -06:00
'jscs',
'tslint',
2015-09-10 05:42:24 -05:00
'clean:release',
'copy:public_to_gen',
2015-09-10 04:26:40 -05:00
'typescript:build',
// 'karma:test',
'phantomjs',
2015-09-10 04:26:40 -05:00
'css',
'htmlmin:build',
'ngtemplates',
2013-11-14 17:07:14 -06:00
'cssmin:build',
2015-02-03 06:36:04 -06:00
'ngAnnotate:build',
'systemjs:build',
'concat:js',
// 'filerev',
// 'remapFilerev',
'usemin',
// 'uglify:genDir'
2013-11-14 17:07:14 -06:00
]);
// task to add [[.AppSubUrl]] to reved path
2015-09-10 05:42:24 -05:00
grunt.registerTask('remapFilerev', function() {
var root = grunt.config().genDir;
var summary = grunt.filerev.summary;
var fixed = {};
for(var key in summary){
if(summary.hasOwnProperty(key)){
var orig = key.replace(root, root+'/[[.AppSubUrl]]/public');
var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]/public');
fixed[orig] = revved;
}
}
grunt.filerev.summary = fixed;
});
2015-01-01 08:28:28 -06:00
grunt.registerTask('build-post-process', function() {
grunt.config('copy.public_gen_to_temp', {
expand: true,
2015-09-10 05:42:24 -05:00
cwd: '<%= genDir %>',
src: '**/*',
dest: '<%= tempDir %>/public/',
});
grunt.config('copy.backend_bin', {
cwd: 'bin',
expand: true,
src: ['*'],
options: { mode: true},
dest: '<%= tempDir %>/bin/'
2013-11-14 17:07:14 -06:00
});
grunt.config('copy.backend_files', {
expand: true,
2015-03-03 03:20:52 -06:00
src: ['conf/defaults.ini', 'conf/sample.ini', 'vendor/**/*', 'scripts/*'],
options: { mode: true},
dest: '<%= tempDir %>'
});
grunt.task.run('copy:public_gen_to_temp');
grunt.task.run('copy:backend_bin');
grunt.task.run('copy:backend_files');
2013-11-14 17:07:14 -06:00
});
};