-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
53 lines (46 loc) · 1.01 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
45
46
47
48
49
50
51
52
53
const {
task,
watch,
src,
dest,
series
} = require('gulp');
const nodemon = require('gulp-nodemon');
const esbuild = require('gulp-esbuild');
const workers = ['transaction']
task('build:server', () => {
workers.map(w => {
src(`src/workers/${w}.worker.ts`)
.pipe(esbuild({
outfile: `${w}.worker.js`,
bundle: true,
platform: 'node',
logLevel: 'info'
}))
.pipe(dest('./dist'))
});
return src('src/index.ts')
.pipe(esbuild({
bundle: true,
platform: 'node',
logLevel: 'info'
}))
.pipe(dest('./dist'))
});
task('dev', series('build:server', () => {
const stream = nodemon({
script: './dist/index.js',
watch: './dist/**/*',
quiet: true,
ext: 'js'
});
let firstStart = true;
stream
.on('start', function () {
if(firstStart) console.log('\u001b[1;32m● Watcher is started\u001b[0m');
firstStart = false;
}).on('restart', function (files) {
console.log('\u001b[1;33m● Application is reloaded\u001b[0m');
});
watch('./src/**/*', series('build:server'));
}));