-
Notifications
You must be signed in to change notification settings - Fork 291
/
gulpfile.js
45 lines (39 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
'use strict'
var pkg = require('./package.json'),
gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sourcemaps = require('gulp-sourcemaps'),
header = require('gulp-header'),
eslint = require('gulp-eslint'),
mocha = require('gulp-mocha'),
benchmark = require('gulp-benchmark'),
banner = '/*! <%= pkg.name %> v<%= pkg.version %> | Copyright (c) 2007-present, <%= pkg.author %> | <%= pkg.license %> */\n'
gulp.task('benchmark', function () {
return gulp
.src('benchmark/*.js', {read: false})
.pipe(benchmark())
})
gulp.task('lint', function() {
return gulp
.src('src/*.js')
.pipe(eslint())
.pipe(eslint.format())
})
gulp.task('test', ['lint'], function() {
return gulp
.src('test/*.js', {read: false})
.pipe(mocha({reporter: 'nyan'}))
})
gulp.task('dist', ['test'], function() {
return gulp.src([
'src/*.js'
])
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(header(banner, {pkg: pkg}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'))
})
gulp.task('default', ['dist'])