-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
64 lines (57 loc) · 1.3 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
62
63
64
'use strict'
// Load plugins
var gulp = require('gulp')
var eslint = require('gulp-eslint')
var del = require('del')
var standardize = require('gulp-standardize')
var babel = require('gulp-babel')
var spawn = require('child_process').spawn
// set paths
var source = ['src/**/*.js']
var dest = ''
gulp.task('lint:standardize', () => {
return gulp.src(source)
.pipe(standardize())
.pipe(standardize.reporter('snazzy'))
.pipe(standardize.reporter('fail'))
})
gulp.task('lint:eslint', () => {
return gulp.src(source)
.pipe(eslint({
envs: ['node'],
extends: 'eslint:recommended',
es6: true,
ecmaFeatures: {
modules: true,
classes: true
}
}))
.pipe(eslint.format())
})
gulp.task('lint', ['lint:standardize', 'lint:eslint'])
gulp.task('build', () => {
return gulp.src(source)
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest(dest))
})
gulp.task('test', ['build'], cb => {
var task = spawn('/bin/sh', ['-c', 'tap -Rspec test/**/*.js'], { stdio: 'inherit' })
task.on('error', cb)
task.on('exit', (code, signal) => {
if (code === 0) {
cb()
} else {
cb(new Error(`Code: ${code}`))
}
})
})
// Clean
gulp.task('clean', cb => {
del(['bin', 'lib', 'test'], cb)
})
// Default task
gulp.task('default', ['lint'], () => {
gulp.start('build')
})