forked from janantala/speech-synthesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (51 loc) · 1.39 KB
/
gulpfile.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
'use strict';
var gulp = require('gulp');
var env = require('gulp-util').env;
var log = require('gulp-util').log;
var dateformat = require('gulp-util').date;
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var header = require('gulp-header');
var rename = require('gulp-rename');
var jshint = require('gulp-jshint');
var karma = require('gulp-karma');
var now = new Date();
var year = dateformat(now, "yyyy");
var pkg = require('./package.json');
var banner = [
'/*!',
' * <%= pkg.name %> v<%= pkg.version %>',
' * The <%= pkg.license %> License',
' * Copyright (c) <%= year %> <%= pkg.authors.join(",") %>',
' */',
'\n'
].join('\n');
var codeFiles = ['src/*.js'];
var testFiles = ['src/*.js', 'test/*.spec.js'];
gulp.task('lint', function(){
log('Linting Files');
return gulp.src(codeFiles)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter());
});
gulp.task('karma', function () {
var options = {
configFile: 'karma.conf.js',
action: 'run'
};
if (process.env.TRAVIS) {
options.browsers = ['Firefox'];
}
return gulp.src(testFiles)
.pipe(karma(options));
});
gulp.task('build', function() {
return gulp.src(codeFiles)
.pipe(uglify({'evil': true}))
.pipe(header(banner, { pkg: pkg, year: year }))
.pipe(rename({
extname: ".min.js"
}))
.pipe(gulp.dest(''));
});
gulp.task('default', ['lint', 'karma']);