-
Notifications
You must be signed in to change notification settings - Fork 86
/
Gruntfile.js
100 lines (87 loc) · 2.69 KB
/
Gruntfile.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
var path = require('path');
var execSync = require('child_process').execSync;
module.exports = function(grunt) {
var config = {
pkg: grunt.file.readJSON(path.join(__dirname, 'package.json')),
appDir: 'app',
tmpDir: '.tmp',
distDir: 'dist',
specDir: 'spec',
tasksDir: 'tasks',
bowerDir: 'bower',
comDir: 'bower_components',
coreDir: __dirname,
poDir: 'po',
livereloadPort: 35729,
};
grunt.initConfig(config);
// Auto-load tasks
require('load-grunt-tasks')(grunt, {
config: path.join(__dirname, 'package'),
pattern: [
'grunt-*',
'@*/grunt-*',
],
});
// Auto-load configuration
require('load-grunt-config')(grunt, {
config: config,
configPath: path.join(__dirname, 'tasks', 'options'),
});
// Test runner tasks and CI
grunt.registerTask('test', ['ngtemplates:dev', 'karma:unit']);
grunt.registerTask('ci', ['test']);
grunt.registerTask('unit', ['test']);
grunt.registerTask('ci:travis', ['ngtemplates:gen-apps', 'ngtemplates:dev', 'karma:travis']);
grunt.registerTask('bamboo', ['karma:bamboo']);
// UI styling documentation
grunt.registerTask('ui-guide', [
'clean',
'ngtemplates:dev',
'ngtemplates:ui-guide',
'copy:assets-ui-guide',
'webpack-dev-server:ui-guide',
]);
// Development server
grunt.registerTask('server', [
'clean',
'ngtemplates:index',
'copy:index',
'copy:config',
'copy:locales',
'ngtemplates:gen-apps',
'ngtemplates:dev',
'webpack-dev-server:start',
]);
// gettext
grunt.registerTask('gettext:extract', ['nggettext_extract']);
// Production build
grunt.registerTask('build', '', () => {
grunt.task.run([
'clean',
'ngtemplates:index',
'copy:index',
'copy:config',
'copy:assets',
'copy:locales',
'ngtemplates:gen-apps',
'ngtemplates:core',
]);
// if we have "*.po" files in "superdesk/client"
// use them to generate "lang.generated.js"
// to support client based translations
var pkgName = grunt.file.readJSON('package.json').name;
if (grunt.file.expand('po/*.po').length && pkgName != 'superdesk-core') {
grunt.task.run([
'nggettext_extract',
]);
}
grunt.task.run([
'webpack:build',
'filerev',
'usemin',
]);
});
grunt.registerTask('package', ['ci', 'build']);
grunt.registerTask('default', ['server']);
};