-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
66 lines (55 loc) · 1.4 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
var exec = require("child_process").exec;
module.exports = function(grunt) {
var buildHeader = [
"/**",
" * ModelList.js v<%= pkg.version %> by <%= pkg.author %>",
" * <%= pkg.repository.url %>",
" * License: <%= pkg.license %>",
" */"
].join("\n");
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
jshint: {
files: ["src/*.js"],
options: grunt.file.readJSON(".jshintrc")
},
uglify: {
options: {
banner: buildHeader,
sourceMap: true,
sourceMapName: "build/ModelList.map"
},
dist: {
files: {
'build/ModelList.min.js': ["src/ModelList.js"]
}
}
},
clean: ["build"],
karma: {
angular: {
configFile: "karma.conf.js"
}
}
});
grunt.registerTask("coveralls", function() {
var done = this.async();
if (!process.env.CI) {
console.log("Aborting coveralls. Not a CI environment!");
done();
return;
}
var path = grunt.file.expand("coverage/**/lcov.info")[0];
exec("cat \"" + path + "\" | node_modules/coveralls/bin/coveralls.js", done);
});
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-karma");
grunt.registerTask("test", ["jshint", "karma", "coveralls"]);
grunt.registerTask("build", [
"clean",
"uglify"
]);
grunt.registerTask("default", ["build"]);
};