-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
105 lines (99 loc) · 2.48 KB
/
Gruntfile.js
File metadata and controls
105 lines (99 loc) · 2.48 KB
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
/**
* Gruntfile config
*
* Author Luca Pau <luca.pau82@gmail.com>
*/
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-test');
var paths = ['Gruntfile.js', 'src/**/*.es6', 'test/**/*.es6'];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
eslint: {
options: {
force: true
},
target: {
files: [{
expand: true,
cwd: 'src/',
src: ['**/*.es6'],
dest: 'lib/',
ext: '.js',
extDot: 'first'
}]
},
test: {
files: [{
expand: true,
cwd: 'test/',
src: ['**/*.es6'],
dest: 'test/',
ext: '.js',
extDot: 'first'
}]
}
},
babel: {
options: {
sourceMap: false
},
dist: {
files: [{
expand: true,
cwd: 'src/',
src: ['**/*.es6'],
dest: 'lib/',
ext: '.js',
extDot: 'first'
}]
}
},
shell: {
/*jshint camelcase: false */
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
mocha_istanbul: {
command: [
'cd src',
'for file in **/*.es6; do mv "$file" "${file%.es6}.js"; done',
'echo files renamed in .js extension',
'cd ..',
'./node_modules/.bin/babel-node ./node_modules/.bin/isparta cover' +
' --root "./src" ./node_modules/.bin/_mocha -- "./test/**/*.es6" ' +
'--compilers js:babel/register --require "./test/index.js"',
'echo coverage launched',
'cd src',
'for file in **/*.js; do mv "$file" "${file%.js}.es6"; done',
'echo files renamed in .es6 extension',
'echo DONE!'
].join(' && ')
}
},
watch: {
files: paths,
tasks: [/*'eslint',*/ 'babel']
},
mochaTest: {
test: {
options: {
reporter: 'spec',
quiet: false,
clearRequireCache: false,
require: 'test/index.js'
},
files: [{
expand: true,
cwd: 'test/',
src: ['**/*.es6'],
extDot: 'first'
}]
}
}
});
grunt.registerTask('default', [/*'eslint',*/ 'babel']);
grunt.registerTask('test', ['mochaTest']);
grunt.registerTask('cover', ['shell:mocha_istanbul']);
};