forked from chancejs/chancejs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
53 lines (46 loc) · 1.58 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
const gulp = require('gulp')
const ava = require('gulp-ava')
const eslint = require('gulp-eslint')
const rename = require('gulp-rename')
const sourcemaps = require('gulp-sourcemaps')
const uglify = require('gulp-uglify')
const pump = require('pump')
gulp.task('lint', () =>
gulp.src(['**/*.js', '!node_modules/**', '!dist/**', '!test/helpers/**/*.js'])
.pipe(eslint({
parser: 'babel-eslint',
rules: {
// quotes: ['error', 'single'],
'curly': 'error',
'eqeqeq': 'error',
'new-parens': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-debugger': 'error',
'no-empty': 'error',
'no-fallthrough': 'error',
'no-trailing-spaces': 'error',
'no-mixed-spaces-and-tabs': 'error',
}
}))
.pipe(eslint.format())
.pipe(eslint.failAfterError())
)
gulp.task('test', () =>
gulp.src('test/**/*.js')
.pipe(ava({ verbose: true }))
)
gulp.task('watch', () => {
var watcher = gulp.watch(['chance.js', 'gulpfile.js', 'test/**/*.js'], ['lint', 'test'])
})
gulp.task('watch-lint', () => {
var watcher = gulp.watch(['chance.js', 'gulpfile.js', 'test/**/*.js'], ['lint'])
})
gulp.task('build', function (cb) {
pump([ gulp.src('chance.js'), sourcemaps.init(),
rename('chance.min.js'), uglify(), sourcemaps.write('.'),
gulp.dest('dist'),
], cb)
})
gulp.task('travis', ['lint', 'test'])
gulp.task('default', ['watch', 'lint', 'test'])