forked from BrodyHolden/battlesnake-node-snakenado
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
39 lines (35 loc) · 1.15 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
const gulp = require('gulp');
const browserify = require('browserify');
const ts = require('gulp-typescript');
const tsProject = ts.createProject('tsconfig.json');
const buffer = require('vinyl-buffer');
// const uglify = require('gulp-uglify');
const source = require('vinyl-source-stream');
const sourcemaps = require('gulp-sourcemaps');
const log = require('gulplog');
gulp.task('ts', function () {
return tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject())
.js
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
});
gulp.task('web', () => {
return browserify({
entries: './dist/web.js',
debug: true
})
.bundle()
.pipe(source('bundle.js'))
.pipe(buffer())
// .pipe(sourcemaps.init({ loadMaps: true }))
// .pipe(uglify())
.on('error', log.error)
// .pipe(sourcemaps.write())
.pipe(gulp.dest('./debug/'));
});
gulp.task('default', gulp.series('ts', 'web'));
gulp.task('watch', gulp.series('ts', 'web', () => {
return gulp.watch(['src/**/*.ts', 'env.json'], gulp.series('default'));
}));