forked from cygnusb2b/fortnight-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
37 lines (32 loc) · 848 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
const {
task,
watch,
src,
parallel,
} = require('gulp');
const eslint = require('gulp-eslint');
const cache = require('gulp-cached');
const { spawn } = require('child_process');
const { log } = console;
let node;
const serve = async () => {
if (node) node.kill();
node = await spawn('node', ['src/index.js'], { stdio: 'inherit' });
node.on('close', (code, signal) => {
const exited = [];
if (code) exited.push(`code ${code}`);
if (signal) exited.push(`signal ${signal}`);
log(`> Node subprocess (via Gulp) exited with ${exited.join(' ')}`);
});
};
const lint = () => src(['src/**/*.js'])
.pipe(cache('lint'))
.pipe(eslint())
.pipe(eslint.format());
task('default', () => {
watch(
['src/**/*.js', 'src/**/*.graphql'],
{ queue: false, ignoreInitial: false },
parallel([serve, lint]),
);
});