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