-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
81 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,58 @@ | ||
'use strict' | ||
|
||
const gulp = require('gulp') | ||
const fun = require('gulp-fun-style') | ||
const eslint = require('gulp-eslint') | ||
const plumber = require('gulp-plumber') | ||
const mocha = require('gulp-spawn-mocha') | ||
const jsdoc = require('gulp-jsdoc3') | ||
|
||
fun.lint = () => | ||
gulp.src(['src/**/*.js', '!src/**/*.doc.js']) | ||
.pipe(plumber()) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()) | ||
|
||
fun.lint.description = 'Lint js source files.' | ||
|
||
|
||
fun.jsdoc = done => | ||
gulp.src(['docs/src/**/*.js', 'README.md']) | ||
.pipe(plumber()) | ||
.pipe(jsdoc(require('./.jsdoc.json'), done)) | ||
|
||
fun.jsdoc.description = 'Create API document.' | ||
|
||
|
||
fun.test = () => | ||
gulp.src(['src/**/*.test.js', 'test/**/*.test.js']) | ||
.pipe(plumber()) | ||
.pipe(mocha()) | ||
|
||
fun.test.description = 'Run the unit tests.' | ||
|
||
|
||
fun.coverage = () => | ||
gulp.src(['src/**/*.test.js', 'test/**/*.test.js']) | ||
.pipe(plumber()) | ||
.pipe(mocha({ istanbul: true })) | ||
|
||
fun.coverage.description = 'Measure the coverage of the unit tests.' | ||
|
||
|
||
fun.watch_test = { | ||
watch: ['src/**/*.js', '!src/**/*.doc.js', 'src/**/*.json'], | ||
call: [['lint', 'coverage']] | ||
const ghelp = require('gulp-showhelp') | ||
|
||
var srcs = ['src/**/*.js', 'test/**/*.js'] | ||
var tests = srcs.concat(['src/**/*.json']) | ||
var docs = ['docs/**/*.js', 'README.md'] | ||
|
||
gulp.task('help', done => { | ||
ghelp.show() | ||
done() | ||
}).help = 'Show help message.' | ||
|
||
gulp.task('lint', () => { | ||
return gulp.src(srcs) | ||
.pipe(plumber()) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()) | ||
}).help = 'Lint js source files.' | ||
|
||
gulp.task('mkdoc', done => { | ||
gulp.src(docs) | ||
.pipe(plumber()) | ||
.pipe(jsdoc(require('./.jsdoc.json'), done)) | ||
}).help = 'Create API document.' | ||
|
||
gulp.task('test', () => { | ||
return gulp.src(tests) | ||
.pipe(plumber()) | ||
.pipe(mocha()) | ||
}).help = 'Run the unit tests.' | ||
|
||
gulp.task('coverage', () => { | ||
return gulp.src(tests) | ||
.pipe(plumber()) | ||
.pipe(mocha({ istanbul: true })) | ||
}).help = 'Measure the coverage of the unit tests.' | ||
|
||
|
||
function watch_for_test() { | ||
return gulp.watch(srcs, gulp.series('lint', 'test')) | ||
} | ||
|
||
|
||
fun.watch_doc = { | ||
watch: ['docs/src/**/*.js', 'README.md'], | ||
call: [['jsdoc']] | ||
function watch_for_doc() { | ||
return gulp.watch(docs, gulp.series('mkdoc')) | ||
} | ||
|
||
|
||
fun.watch = ['watch_test', 'watch_doc'] | ||
|
||
fun.watch.description = 'Watch file changes, then lint, test or jsdoc' | ||
gulp.task('watch', gulp.parallel(watch_for_test, watch_for_doc)) | ||
.help = 'Watch file changes, then lint, test or jsdoc' | ||
|
||
|
||
fun.default = [['lint', 'coverage', 'jsdoc']] | ||
gulp.task('default', gulp.series('lint', 'coverage', 'mkdoc')) | ||
.help = 'Default task: lint & coverage & mkdoc' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters