forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_task.js
72 lines (65 loc) · 1.73 KB
/
build_task.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
module.exports = function(grunt) {
"use strict";
// Concat and Minify the src directory into dist
grunt.registerTask('build', [
'jshint:source',
'jshint:tests',
'jscs',
'tslint',
'clean:release',
'copy:node_modules',
'copy:public_to_gen',
'typescript:build',
'karma:test',
'phantomjs',
'css',
'htmlmin:build',
'ngtemplates',
'cssmin:build',
'ngAnnotate:build',
'systemjs:build',
'concat:js',
'filerev',
'remapFilerev',
'usemin',
'uglify:genDir'
]);
// task to add [[.AppSubUrl]] to reved path
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;
});
grunt.registerTask('build-post-process', function() {
grunt.config('copy.public_gen_to_temp', {
expand: true,
cwd: '<%= genDir %>',
src: '**/*',
dest: '<%= tempDir %>/public/',
});
grunt.config('copy.backend_bin', {
cwd: 'bin',
expand: true,
src: ['*'],
options: { mode: true},
dest: '<%= tempDir %>/bin/'
});
grunt.config('copy.backend_files', {
expand: true,
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');
});
};