-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
44 lines (33 loc) · 1.03 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
const {parallel} = require('gulp');
const nodemon = require('gulp-nodemon');
const {task} = require('gulp-execa');
const execa = require('execa');
const dotenv = require('dotenv');
const waitForLocalhost = require('wait-for-localhost');
const now = require('./now.json');
const config = dotenv.config();
const env = Object.assign(now.env, config.parsed);
let pinoColada;
async function server(done) {
await waitForLocalhost({port: 27017, useGet: true});
nodemon({
script: './app.js',
ignore: ['.next', 'data', 'node_modules', 'pages', 'components'],
env,
stdout: false,
readable: false,
done
}).on('readable', function() {
if (pinoColada) {
pinoColada.kill();
}
pinoColada = execa('pino-colada');
pinoColada.stdout.pipe(process.stdout);
pinoColada.stderr.pipe(process.stderr);
this.stdout.pipe(pinoColada.stdin);
this.stderr.pipe(pinoColada.stdin);
});
}
const mongo = task('docker-compose up -d mongo');
exports.compose = parallel(mongo, server);
exports.default = server;