-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
48 lines (35 loc) · 1.01 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
var fs = require('fs');
module.exports = function(grunt) {
grunt.initConfig({
babel: {
dist: {
files: (function() {
var files = {
'wulu/index.js': 'wulu/src/index.js'
};
var rootDir = fs.readdirSync('wulu/src');
var cmdDir = fs.readdirSync('wulu/src/commands');
rootDir.forEach(function(f) {
if (f.indexOf('.js') < 0 || f === 'index.js') return;
files['wulu/build/' + f] = 'wulu/src/' + f;
});
cmdDir.forEach(function(f) {
if (f.indexOf('.js') < 0) return;
files['wulu/build/commands/' + f] = 'wulu/src/commands/' + f;
});
return files;
})()
}
},
watch: {
babel: {
files: 'wulu/src/**/*.js',
tasks: ['babel']
}
}
});
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('es6', ['babel']);
grunt.registerTask('default', ['babel', 'watch']);
};