-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
53 lines (44 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
52
53
var gulp = require('gulp');
var ts = require('gulp-typescript');
var babel = require('gulp-babel');
var rename = require('gulp-rename');
var del = require('del');
var plumber = require('gulp-plumber');
var paths = {
config: __dirname + '/tsconfig.json',
steps: 'src/steps/*.ts',
support: 'src/support/*.ts',
bootstrap: 'src/index.js',
build: 'build'
};
function compile(src, dest, typescript) {
var task = gulp.src(src, { base: 'src' })
.pipe(plumber());
if (typescript) {
task = task.pipe(ts(ts.createProject(paths.config)));
}
return task
.pipe(babel({
presets: ['es2015', 'stage-0']
}))
.pipe(rename(function (path) {
path.extname = '.js';
}))
.pipe(gulp.dest(dest));
}
gulp.task('compile-sources', ['cleanup'], function () {
return compile([paths.steps, paths.support], paths.build, true);
});
gulp.task('cleanup', function() {
return del(paths.build);
});
gulp.task('watch', function () {
gulp.watch(['src/**/*.ts'], ['compile-sources']);
});
gulp.task('dev', [
'compile-sources',
'watch'
]);
gulp.task('default', [
'compile-sources'
]);