-
Notifications
You must be signed in to change notification settings - Fork 321
/
Copy pathgulpfile.js
67 lines (57 loc) · 1.6 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
65
66
67
const gulp = require('gulp');
const mocha = require('gulp-mocha');
const eslint = require('gulp-eslint');
const watch = require('gulp-watch');
const sass = require('gulp-sass');
const gulpIf = require('gulp-if');
const ghPages = require('gulp-gh-pages');
const babel = require('gulp-babel');
const chmod = require('gulp-chmod');
const nodeunit = require('gulp-nodeunit');
gulp.task('deploy', ['build'], function() {
return gulp.src('./docs/**/*')
.pipe(ghPages());
});
gulp.task('scripts', () => {
gulp.src('./lib/src/**/*.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('dist'));
gulp.src('./lib/src/**/*.json')
.pipe(gulp.dest('dist'));
gulp.src('./lib/*.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(chmod(0o755))
.pipe(gulp.dest('bin'));
});
gulp.task('lint', () => {
const isFixed = file => file.eslint != null && file.eslint.fixed;
return gulp.src('./lib/**/*.js')
.pipe(
eslint({
fix: true,
envs: [
'node'
]
})
)
.pipe(eslint.format())
.pipe(gulpIf(isFixed, gulp.dest('./lib/')));
});
gulp.task('watch', () => {
return gulp.watch('./lib/**/*.js', ['lint', 'scripts']);
});
gulp.task('test', () => {
gulp.src('test/**/*.js')
.pipe(nodeunit({
reporter: 'junit',
reporterOptions: {
output: 'test'
}
}));
});
gulp.task('build', ['lint', 'scripts', 'test']);
gulp.task('default', ['build', 'watch']);