-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
37 lines (31 loc) · 959 Bytes
/
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
'use strict';
const gulp = require( 'gulp' );
const changed = require( 'gulp-changed' );
const mocha = require( 'gulp-mocha' );
const eslint = require( 'gulp-eslint' );
const rename = require( 'gulp-rename' );
const chmod = require( 'gulp-chmod' );
gulp.task( 'copy script', () => {
const dest = 'scripts';
return gulp.src( 'bin/eslint-pre-commit' )
.pipe( chmod( 744 ))
.pipe( gulp.dest( dest ));
});
gulp.task( 'copy eslintrc', () => {
const dest = './';
return gulp.src( 'bin/eslintrc' )
.pipe( changed( dest ))
.pipe( rename( '.eslintrc' ))
.pipe( gulp.dest( dest ));
});
gulp.task( 'lint', [ 'copy script', 'copy eslintrc' ], () => {
return gulp.src([ '**/*.js', '!node_modules/**' ])
.pipe( eslint())
.pipe( eslint.format())
.pipe( eslint.failAfterError());
});
gulp.task( 'test', ['lint'], () => {
return gulp.src(['test/**/*.js'])
.pipe( mocha());
});
gulp.task( 'default', ['test']);