-
Notifications
You must be signed in to change notification settings - Fork 48
/
Gruntfile.js
96 lines (83 loc) · 2.82 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
/*global module:false require:true*/
module.exports = function(grunt) {
"use strict";
var fs = require('fs');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-concat');
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
meta: {
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>' + "\n" +
'<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.contributors[0].name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' +
' */'
},
jshint: {
options: {
"-W106": true, // Ignore warning "Identifier 'ext_disableQuirkDetection' is not in camel case."
globals: {
jQuery: true,
"$": true,
bililiteRange: true
},
},
tests: {
options: {
jshintrc: true
},
src: ['tests/drag-n-drop.js', 'tests/key-combo.js', 'tests/key-sequence.js', 'tests/testInfrastructure.js']
},
src: ['src/*.js', 'libs/jquery.simulate.js'],
grunt: 'Gruntfile.js',
},
qunit: {
files: ['tests/tests.html']
},
concat: {
'ext-only': {
src: ['src/jquery.simulate.ext.js', 'src/jquery.simulate.drag-n-drop.js', 'src/jquery.simulate.key-sequence.js', 'src/jquery.simulate.key-combo.js'],
dest: 'dist/jquery.simulate.ext.<%= pkg.version %>.js'
},
complete: {
src: ['libs/bililiteRange.js', 'libs/jquery.simulate.js', 'src/jquery.simulate.ext.js', 'src/jquery.simulate.drag-n-drop.js', 'src/jquery.simulate.key-sequence.js', 'src/jquery.simulate.key-combo.js'],
dest: 'dist/jquery.simulate.ext.<%= pkg.version %>.complete.js'
}
},
/* uglify task is not working correctly at the moment (strips away copyright notices)
* therefore, we cannot use it
uglify: {
'ext-only': {
options: {
banner: '<%= meta.banner %>'
},
src: ['<%= concat["ext-only"].dest %>'],
dest: 'dist/jquery.simulate.ext.<%= pkg.version %>.min.js'
},
complete: {
options: {
preserveComments: function(node, comment) {
if (comment.value.search(/Copyright/i) != -1)
return true;
else
return false;
}
},
src: ['<%= concat["complete"].dest %>'],
dest: 'dist/jquery.simulate.ext.<%= pkg.version %>.complete.min.js'
}
},
*/
"multi-banner-min": {
complete: {
src: ['<banner:meta.simulate-banner>', 'libs/jquery.simulate.js', '<banner:meta.banner>', '<%= concat["ext-only"].dest %>'],
dest: 'dist/jquery.simulate.ext.<%= pkg.version %>.complete.min.js'
}
}
});
// Default task.
grunt.registerTask('default', ['jshint', 'qunit', 'concat']);
};