-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
51 lines (47 loc) · 1.16 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
const babel = require('gulp-babel');
const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const nodemon = require('gulp-nodemon');
const path = require('path');
const sourceMapConfig = {
debug: true,
includeContent: false,
sourceRoot: (file) => (path.join(path.relative(file.path, path.join(__dirname, 'src')), 'src')),
};
gulp.task('server:prod', () => {
nodemon({
env: {
NODE_ENV: JSON.stringify('production'),
DEBUG: 'lunch:*',
},
script: 'out/server/start.js',
verbose: false,
ignore: ['*'],
watch: ['noop/'],
ext: 'noop',
});
});
gulp.task('server:dev', () => {
nodemon({
env: {
NODE_ENV: JSON.stringify('development'),
DEBUG: 'lunch:*',
},
delay: 10,
script: 'out/server/start.js',
ext: 'js',
verbose: false,
ignore: ['*'],
watch: ['out/server/**/*', 'out/shared/**/*'],
});
});
gulp.task('build', () => gulp.src([
'src/server/**/*.js',
'src/shared/**/*.js',
'src/client/**/*.js',
'src/test/**/*.js',
], { base: './src' })
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.', sourceMapConfig))
.pipe(gulp.dest('out')));