forked from github-tools/github-release-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
44 lines (36 loc) · 1.1 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
const babel = require('gulp-babel');
const chmod = require('gulp-chmod');
const eslint = require('gulp-eslint');
const gulp = require('gulp');
const gulpIf = require('gulp-if');
gulp.task('scripts', done => {
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())
.pipe(chmod(0o755))
.pipe(gulp.dest('bin'));
done();
});
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', () => gulp.watch('./lib/**/*.js', gulp.series(['lint', 'scripts'])));
gulp.task('build', gulp.series(['lint', 'scripts']));
gulp.task('default', gulp.series(['build', 'watch']));