-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
98 lines (92 loc) · 2.67 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
module.exports = function(grunt) {
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-release');
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
dist: 'dist',
meta: {
modules: 'angular.module("angular.resumable", ["resumable.js-services", "resumable.js-directives"]);',
tplmodules: 'angular.module("angular.resumable.tpls", ["resumable.js-templates"]);',
all: 'angular.module("angular.resumable", ["resumable.js-templates", "resumable.js-services", "resumable.js-directives"]);'
},
jshint: {
files: ['Gruntfile.js','src/**/*.js'],
options: {
curly: true,
immed: true,
newcap: true,
noarg: true,
sub: true,
boss: true,
eqnull: true,
globals: {
angular: true
}
}
},
karma: {
options: {
configFile: 'karma.conf.js'
},
continuous: {
singleRun: true
},
travis: {
singleRun: true,
browsers: ['Firefox']
}
},
concat: {
dist: {
src: [
'src/angular-resumable.js-service.js',
'src/angular-resumable.js-directives.js'
],
dest: '<%= dist %>/<%= pkg.name %>-<%= pkg.version %>.js'
},
dist_tpls: {
src: [
'src/angular-resumable.js-service.js',
'src/angular-resumable.js-directives.js',
'src/angular-resumable.js-templates.js'
],
dest: '<%= dist %>/<%= pkg.name %>-tpls-<%= pkg.version %>.js'
}
},
uglify: {
dist:{
options: {
banner: '// <%= pkg.name %>-<%= pkg.version %>.js\n<%= meta.modules %>\n'
},
src:['<%= dist %>/<%= pkg.name %>-<%= pkg.version %>.js'],
dest:'<%= dist %>/<%= pkg.name %>-<%= pkg.version %>.min.js'
},
dist_tpls:{
options: {
banner: '// <%= pkg.name %>-<%= pkg.version %>-tpls.js\n<%= meta.all %>\n'
},
src:['<%= dist %>/<%= pkg.name %>-tpls-<%= pkg.version %>.js'],
dest:'<%= dist %>/<%= pkg.name %>-tpls-<%= pkg.version %>.min.js'
}
},
release: {
npm: false
}
});
// Register before and after test tasks so we've don't have to change cli options on the goole's CI server
grunt.registerTask('before-test', ['jshint']);
grunt.registerTask('after-test', ['build']);
grunt.registerTask('test', 'Run tests on singleRun karma server', function() {
grunt.task.run(process.env.TRAVIS ? 'karma:travis' : 'karma:continuous');
});
grunt.registerTask('build', 'Create build files', function() {
grunt.task.run(['concat', 'uglify']);
});
// Default task(s).
grunt.registerTask('default', ['before-test', 'test', 'after-test']);
};