File: gulpfile.js

package info (click to toggle)
node-chance 2.2.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,612 kB
  • sloc: javascript: 16,572; makefile: 4
file content (49 lines) | stat: -rw-r--r-- 1,595 bytes parent folder | download | duplicates (3)
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
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', '!docs/**', '!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', () => {
    gulp.watch(['chance.js', 'gulpfile.js', 'test/**/*.js'], ['lint', 'test'])
})

gulp.task('watch-lint', () => {
    gulp.watch(['chance.js', 'gulpfile.js', 'test/**/*.js'], ['lint'])
})

gulp.task('build', (cb) => {
    pump([ gulp.src('chance.js'), sourcemaps.init(),
        rename('chance.min.js'), uglify(), sourcemaps.write('.'),
        gulp.dest('dist'),
    ], cb)
})

gulp.task('travis', gulp.series('lint', 'test'))

gulp.task('default', gulp.series('watch', 'lint', 'test'))