forked from angular/watchtower.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
51 lines (45 loc) · 1.24 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
var gulp = require('gulp'),
karma = require('./lib/gulp/karma'),
traceur = require('gulp-traceur'),
jshint = require('gulp-jshint'),
path = require('path');
gulp.task('lint', function() {
gulp.src('src/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
gulp.task('build:amd', function() {
gulp.src('src/*.js')
.pipe(traceur({
modules: 'amd',
types: true,
annotations: true,
sourceMap: true
}))
.pipe(gulp.dest(path.resolve(__dirname,'build/amd')));
});
gulp.task('build:cjs', function() {
gulp.src('src/*.js')
.pipe(traceur({
modules: 'commonjs',
types: true,
annotations: true,
sourceMap: true
}))
.pipe(gulp.dest(path.resolve(__dirname,'build/commonjs')));
});
gulp.task('build', ['lint', 'build:amd', 'build:cjs'], function() {
});
gulp.task('test', function(done) {
var options = {
configFile: 'karma.conf.js'
};
for (var i=0, ii = process.argv.length; i<ii; ++i) {
var val = process.argv[i];
if (val === '--watch') options.autoWatch = true;
else if (val === '--single-run') options.singleRun = true;
else if (val === '--browsers') options.browsers = process.argv[++i].split(',');
}
karma(options, done);
});