-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathGruntfile.js
48 lines (45 loc) · 1.25 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
"use strict";
var fs = require('fs')
, path = require('path')
, regenerator = require('regenerator');
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
all: ['*.js', 'lib/*.js', 'test/*.js']
, options: {
laxcomma: true
, esnext: true
, trailing: true
, node: true
, strict: true
}
}
, mochaTest: {
unit: ['test/*.js']
}
, mochaTestConfig: {
options: {
timeout: 60000,
reporter: 'spec'
}
}
});
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-jshint');
//grunt.registerTask('lint', ['jshint']);
grunt.registerTask('unit', 'mochaTest:unit');
grunt.registerTask('test', ['unit']);
grunt.registerTask('default', ['build']);
grunt.registerTask('travis', ['unit']);
grunt.registerTask('build', function() {
var thisDir = path.resolve(__dirname, "lib");
console.log("Getting es6 source");
var source6 = fs.readFileSync(path.resolve(thisDir, "yiewd.js"), {
encoding: 'utf8'
});
console.log("Generating es5 source");
var es5Source = regenerator(source6);
console.log("Writing es5 source");
fs.writeFileSync(path.resolve(thisDir, "yiewd-es5.js"), es5Source);
});
};