forked from CNXTEoEorg/shift-js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
78 lines (69 loc) · 1.51 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
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
eslint: {
options: {
configFile: 'eslint_ecma5.json',
reset: true
},
target: ['lib/**', 'test/**', '!test/mocha.opts', 'Gruntfile.js', 'index.js']
},
pkg: grunt.file.readJSON('package.json'),
browserify: {
js: {
src: './index.js',
dest: './dist/shift-js.js'
},
options: {
browserifyOptions: {
standalone: 'shift'
}
}
},
watch: {
scripts: {
files: ['lib/*.js'],
tasks: ['eslint', 'browserify'],
options: {
spawn: false,
livereload: true
},
},
},
exec: {
coverageSingle: {
command: 'node_modules/.bin/istanbul cover --dir test/.coverage-unit ./node_modules/.bin/_mocha $TEST'
}
},
uglify: {
options: {
mangle: false
},
myTarget: {
files: {
'dist/shift-js.min.js': ['dist/shift-js.js']
}
}
},
coveralls: {
src: 'test/.coverage-unit/*.info'
}
});
grunt.registerTask('eslint-fix', 'Run eslint and fix formatting', function () {
grunt.config.set('eslint.options.fix', true);
grunt.task.run('eslint');
});
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-force');
grunt.loadNpmTasks('grunt-coveralls');
grunt.registerTask('travis', ['eslint', 'exec:coverageSingle', 'coveralls']);
grunt.registerTask('default', [
'force:on',
'browserify',
'eslint',
'uglify',
'watch'
]);
};