-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
161 lines (147 loc) · 3.32 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
module.exports = function(grunt) {
grunt.initConfig({
// Load this module info
pkg: grunt.file.readJSON('package.json'),
// Add banner to the JS scripts
usebanner: {
default: {
options: {
position: 'top',
banner: grunt.file.read('./assets/banner'),
linebreak: true
},
files: {
src: './dist/**/*.js'
}
}
},
run: {
// Run all the tests inside the test folder
mocha: {
args: [
'./node_modules/mocha/bin/mocha',
'./test/**/test-*.js',
'--reporter',
'spec',
'--bail'
],
},
// Run all the tests inside the test folder
karma: {
args: [
'./node_modules/karma/bin/karma',
'start',
'./.karma.conf.js'
],
},
// Run JSDOC
doc: {
args: [
'./node_modules/jsdoc-to-markdown/bin/cli.js',
'./lib/**/*.js',
'./.jsdocrc'
],
},
// Look for JavaScript errors
hint: {
args: [
'./node_modules/jshint/bin/jshint',
'./lib',
'./test',
'./examples',
'./Gruntfile.js'
],
},
// Runs test coverages
istanbul: {
args: [
'./node_modules/istanbul/lib/cli.js',
'cover',
'./node_modules/mocha/bin/_mocha',
'--report',
'lcovonly',
'--',
'--reporter',
'spec',
'--bail',
'./test/**/test-*.js'
]
},
// Send coverage results to Coveralls
coveralls: {
exec: 'cat ./coverage/lcov.info | ' +
'./node_modules/coveralls/bin/coveralls.js'
}
},
jsdoc2md: {
api: {
src: './lib//bolty.js',
dest: './docs/api.md'
},
encoders: {
src: './lib//encoders.js',
dest: './docs/encoders.md'
},
decoders: {
src: './lib//decoders.js',
dest: './docs/decoders.md'
}
},
browserify: {
bundle: {
files: {
'./dist/bolty-bundle.js': './lib/bolty.js',
}
},
'no-buffer': {
files: {
'./dist/bolty.js': './lib/bolty.js',
},
options: {
external: ['buffer']
}
}
},
uglify: {
bundle: {
files: {
'./dist/bolty-bundle.min.js': './dist/bolty-bundle.js'
}
},
'no-buffer': {
files: {
'./dist/bolty.min.js': './dist/bolty.js'
}
}
}
});
// Registering custom named tasks for easy access
grunt.registerTask('test', [
'run:hint',
'run:mocha',
'run:karma'
]);
// Registering custom named tasks for easy access
grunt.registerTask('doc', [
'jsdoc2md'
]);
// This is the command that Travis will run
grunt.registerTask('travis', [
'run:hint',
'run:karma',
'run:istanbul',
'run:coveralls'
]);
// Build scripts for the browser
grunt.registerTask('build', [
'browserify',
'uglify',
'usebanner'
]);
// Loading NPM Grunt plugins
grunt.loadNpmTasks('grunt-run');
grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-banner');
};