-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulp.js
34 lines (32 loc) · 957 Bytes
/
gulp.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
/**
* Since we need to include the gulp for testing
* might as well export this back so the developer
* don't need to add add it to the dependecies
*/
const chalk = require('chalk');
const gulp = require('gulp');
const helmet = require('helmet');
const bodyParser = require('body-parser');
const streamWatcher = require('./src/lib/utils/stream-watcher');
console.log(
chalk.red('This file will be remove in the 1.4.0 final release! Please use'),
chalk.yellow('gulp-server-io/export')
);
// Re-export
exports.gulp = gulp;
exports.helmet = helmet;
exports.bodyParser = bodyParser;
exports.streamWatcher = streamWatcher;
exports.watcher = function(filePaths, callback, verbose = true, debounce = 300) {
let files = [];
return streamWatcher(filePaths, verbose)
.doAction(f => files.push(f))
.debounce(debounce)
.onValue(() => {
if (files.length) {
callback(files);
// Reset
files = [];
}
});
};