forked from ninjaPixel/node-sscheduler
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
34 lines (31 loc) · 938 Bytes
/
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
var gulp = require("gulp");
var ts = require("gulp-typescript");
var sourcemaps = require('gulp-sourcemaps');
var babel = require('gulp-babel');
var uglify = require('gulp-uglify');
var gutil = require('gulp-util');
var tsProject = ts.createProject("tsconfig.json");
gulp.task("build", function () {
return tsProject.src()
.pipe(tsProject())
.js.pipe(gulp.dest("build"));
});
gulp.task("es5", ["build"], function () {
return gulp.src('build/**/*')
.pipe(sourcemaps.init())
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('es5'));
});
gulp.task("default", ["es5"],function () {
return gulp.src('es5/**/*.js')
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify({mangle: true}))
.pipe(sourcemaps.write('.'))
.on('error', function (err) {
gutil.log(gutil.colors.red('[Error]'), err.toString());
})
.pipe(gulp.dest("dist"));
});