-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
106 lines (96 loc) · 3.75 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
101
102
103
104
105
106
/**
*
*/
var fs = require('fs');
var parseString = require('xml2js').parseString;
var parseVersionFromPomXml = function() {
var version;
var pomXml = fs.readFileSync('pom.xml', "utf8");
parseString(pomXml, function (err, result){
version = result.project.version[0];
});
return version;
};
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/main/webapp/scripts/<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
}
},
copy: {
assets: {
expand: true,
src: [
'node_modules/angular/angular.min.js',
'node_modules/angular/angular.min.js.map',
'node_modules/bootstrap/dist/css/bootstrap.min.css',
'node_modules/bootstrap/dist/css/bootstrap.css.map',
'node_modules/bootstrap/dist/fonts/*',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/angular-route/angular-route.min.js',
'node_modules/angular-route/angular-route.min.js.map',
'node_modules/jquery/dist/jquery.min.js',
'node_modules/jquery/dist/jquery.min.map',
'node_modules/angular-translate/dist/angular-translate.min.js',
'node_modules/angular-local-storage/dist/angular-local-storage.min.js',
'node_modules/angular-dynamic-locale/tmhDynamicLocale.min.js',
'node_modules/angular-dynamic-locale/tmhDynamicLocale.min.js.map',
'node_modules/angular-resource/angular-resource.min.js',
'node_modules/angular-resource/angular-resource.min.js.map',
'node_modules/angular-ui-router/release/angular-ui-router.min.js',
'node_modules/angular-cookies/angular-cookies.min.js',
'node_modules/angular-cookies/angular-cookies.min.js.map',
'node_modules/angular-cache-buster/angular-cache-buster.js',
'node_modules/angular-translate/dist/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js',
'node_modules/angular-translate/dist/angular-translate-loader-partial/angular-translate-loader-partial.min.js',
'node_modules/angular-i18n/*',
'bower_components/angular-ui-grid/ui-grid.css',
'bower_components/angular-ui-grid/ui-grid.svg',
'bower_components/angular-ui-grid/ui-grid.ttf',
'bower_components/angular-ui-grid/ui-grid.woff',
'bower_components/angular-ui-grid/ui-grid.js',
'node_modules/bootbox/bootbox.min.js'
],
dest: 'src/main/webapp/',
filter: 'isFile'
},
},
ngconstant: {
options: {
name: 'angularSpringApp',
deps: false,
wrap: '"use strict";\n// DO NOT EDIT THIS FILE, EDIT THE GRUNT TASK NGCONSTANT SETTINGS INSTEAD WHICH GENERATES THIS FILE\n{%= __ngModule %}'
},
dev: {
options: {
dest: 'src/main/webapp/scripts/app/app.constants.js',
},
constants: {
ENV: 'dev',
VERSION: parseVersionFromPomXml()
}
},
prod: {
options: {
dest: '.tmp/scripts/app/app.constants.js',
},
constants: {
ENV: 'prod',
VERSION: parseVersionFromPomXml()
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-ng-constant');
// Default task(s).
grunt.registerTask('make-all', ['copy:assets']);
};