-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathGruntfile.js
54 lines (50 loc) · 1.37 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
module.exports = function(grunt) {
var banner = "/*! <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today('yyyy-mm-dd') %> */";
var srcFiles = ["src/init.js", "src/constants.js", "src/jsonFormatter.js", "src/baseAPI.js", "src/scormAPI.js", "src/scormAPI2004.js"];
var testFiles = srcFiles.concat("test/**/*.js");
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
concat: {
options: {
banner: banner + "\n\n"
},
dist: {
src: srcFiles,
dest: "build/scormAPI.js"
}
},
eslint: {
dist: srcFiles
},
karma: {
options: {
browsers: ["ChromeHeadless"],
files: testFiles,
frameworks: ["mocha", "sinon-chai"],
reporters: ["dots"]
},
dev: {},
dist: {
singleRun: true
}
},
uglify: {
options: {
banner: banner
},
dist: {
files: {
"build/scormAPI.min.js": srcFiles
}
}
}
});
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-karma");
grunt.loadNpmTasks("gruntify-eslint");
grunt.registerTask("build", ["concat:dist", "uglify:dist"]);
grunt.registerTask("test", ["eslint:dist", "karma:dist"]);
grunt.registerTask("watch", ["karma:dev"]);
grunt.registerTask("default", ["test", "build"]);
};