-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
135 lines (126 loc) · 3.21 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/**
* @TODO: use Google closure compiler
*/
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
clean: {
test: ['build/profiler.test.js']
},
concat: {
dev: {
files: {
'build/profiler.js': [
'src/browser/supports.js',
'src/lang/typeof.js',
'src/lang/each.js',
'src/lang/filter.js',
'src/provider/http.js',
'src/start.js',
'src/record.js',
'src/report.js',
'src/profiler.js'
]
}
},
test: {
files: {
'build/profiler.test.js': [
'test/fixture/performance.js',
'test/fixture/xhr.js',
'src/browser/supports.js',
'src/lang/typeof.js',
'src/lang/each.js',
'src/lang/filter.js',
'src/provider/http.js',
'src/start.js',
'src/record.js',
'src/report.js',
'src/profiler.js'
]
}
}
},
jasmine: {
dev: {
src: 'build/profiler.test.js',
options: {
specs: 'test/specs/profiler.spec.js',
template: require('grunt-template-jasmine-istanbul'),
templateOptions: {
coverage: 'test/report/coverage.json',
report: [
{
type: 'html',
options: {
dir: 'test/report/html'
}
}
]
}
}
},
prod: {
src: 'build/profiler.min.js',
options: {
specs: 'test/specs/profiler.spec.js',
template: require('grunt-template-jasmine-istanbul'),
templateOptions: {
coverage: 'test/report/coverage.json',
report: [
{
type: 'html',
options: {
dir: 'test/report/html'
}
}
]
}
}
}
},
jshint: {
alldev: [
'Gruntfile.js',
'build/profiler.js'
],
options: {
jshintrc: '.jshintrc'
}
},
watch: {
dev: {
files: [
'Gruntfile.js',
'src/**/*.js',
'src/*.js'
],
tasks: ['default']
}
},
wrap: {
all: {
src: ['build/profiler.js'],
dest: '',
wrapper: [
';(function (undefined) {\n\'use strict\';\n',
'\n}());'
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-wrap');
grunt.registerTask('build-dev', ['concat:dev', 'wrap']);
grunt.registerTask('build-test', ['concat:test', 'wrap']);
grunt.registerTask('build-prod', ['build-dev']);
grunt.registerTask('test-dev', ['build-test', 'jasmine:dev']);
grunt.registerTask('test-prod', ['build-prod', 'jasmine:prod']);
grunt.registerTask('test', ['test-dev']);
grunt.registerTask('prod', ['build-prod']);
grunt.registerTask('hint', ['build-dev', 'jshint']);
grunt.registerTask('default', ['build-dev']);
};