-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathGruntfile.js
129 lines (118 loc) · 4.07 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
module.exports = function (grunt) {
var package = grunt.file.readJSON('package.json');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-qunit-junit');
grunt.loadNpmTasks('grunt-bg-shell');
grunt.loadNpmTasks('grunt-qunit-istanbul');
grunt.loadNpmTasks('grunt-coveralls');
grunt.loadNpmTasks('grunt-bump');
// Project configuration.
grunt.initConfig({
requirejs: {
compile: {
options: {
baseUrl: "src",
name: "regula",
out: function(text, sourceMapText) {
text = text.replace(/{version}/, package.version);
grunt.file.write("dist/regula-" + package.version + ".min.js", text);
},
uglify2: {
output: {
beautify: true
},
compress: {
sequences: true,
properties: true,
conditionals: true,
evaluate: true,
booleans: true,
comparisons: true,
loops: true,
join_vars: true,
cascade: true
}
},
wrap: {
startFile: "src/header.frag"
}
}
},
unoptimized: {
options: {
baseUrl: "src",
name: "regula",
out: function(text, sourceMapText) {
text = text.replace(/{version}/, package.version);
grunt.file.write("dist/regula-" + package.version + ".js", text);
},
optimize: "none",
wrap: {
startFile: "src/header.frag"
}
}
},
test: {
options: {
baseUrl: "src",
name: "regula",
out: "dist/regula-built-test.js",
optimize: "none"
}
}
},
qunit: {
options: {
'--web-security': 'no',
coverage: {
src: ['dist/regula-built-test.js'],
instrumentedFiles: 'temp/',
htmlReport: 'dist/test-reports/coverage',
lcovReport: 'dist/test-reports/lcov',
coberturaReport: 'dist/test-reports/',
linesThresholdPct: 85
}
},
all: ['scaffold/test/regula-test.html']
},
qunit_junit: {
options: {
dest: 'dist/test-reports'
}
},
coveralls: {
options: {
force: false
},
main_target: {
src: 'dist/test-reports/lcov/lcov.info'
}
},
bgShell: {
_defaults: {
bg: true
},
startAsyncTestServer: {
cmd: 'node ./src/test/async-test-server.js',
stdout: false
},
stopAsyncTestServer: {
cmd: 'curl "http://localhost:8888/?shutdown"',
stdout: false
}
},
bump: {
options: {
files: ['package.json'],
commit: false,
push: false,
createTag: false
}
}
});
grunt.registerTask('test', ['requirejs:test', 'bgShell:startAsyncTestServer', 'qunit_junit', 'qunit', 'bgShell:stopAsyncTestServer']);
grunt.registerTask('build', ['requirejs:compile', 'requirejs:unoptimized']);
grunt.registerTask('release', ['bump', 'test', 'build']);
grunt.registerTask('travis', ['test']);
};