forked from owenashurst/agar.io-clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
63 lines (53 loc) · 1.7 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
54
55
56
57
58
59
60
61
62
63
var gulp = require('gulp');
var babel = require('gulp-babel');
var jshint = require('gulp-jshint');
var nodemon = require('gulp-nodemon');
var uglify = require('gulp-uglify');
var util = require('gulp-util');
var mocha = require('gulp-mocha');
var webpack = require('webpack-stream');
gulp.task('build', ['build-client', 'build-server', 'test']);
gulp.task('test', ['lint'], function () {
gulp.src(['test/**/*.js'])
.pipe(mocha());
});
gulp.task('lint', function () {
return gulp.src(['**/*.js', '!node_modules/**/*.js', '!bin/**/*.js'])
.pipe(jshint({
esnext: true
}))
.pipe(jshint.reporter('default', { verbose: true}))
.pipe(jshint.reporter('fail'));
});
gulp.task('build-client', ['lint', 'move-client'], function () {
return gulp.src(['src/client/js/app.js'])
.pipe(webpack(require('./webpack.config.js')))
//.pipe(uglify())
.pipe(gulp.dest('bin/client/js/'));
});
gulp.task('move-client', function () {
return gulp.src(['src/client/**/*.*', '!client/js/*.js'])
.pipe(gulp.dest('./bin/client/'));
});
gulp.task('build-server', ['lint'], function () {
return gulp.src(['src/server/**/*.*', 'src/server/**/*.js'])
.pipe(babel())
.pipe(gulp.dest('bin/server/'));
});
gulp.task('watch', ["build"], function () {
gulp.watch('src/client/**/*.*', ['build-client', 'move-client']);
gulp.watch('src/server/*.*', 'src/server/**/*.js', ['build-server']);
gulp.start('run');
});
gulp.task('run', ['build'], function () {
nodemon({
delay: 10,
script: './server/server.js',
cwd: "./bin/",
args: ["config.json"],
ext: 'html js css'
})
.on('restart', function () {
util.log('server restarted!');
});
});