-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
58 lines (50 loc) · 1.61 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
/**
* gulpfile created on 4/14/17 10:25 PM.
*
* @description Gulp configuration file. Compiles Typescript code to ES5.
* @author Florian Popa <florian@webgenerals.com>
*/
'use strict';
var gulp = require('gulp');
var ts = require('gulp-typescript');
var tsProject = ts.createProject('tsconfig.json');
var merge = require('merge2');
var sourcemaps = require('gulp-sourcemaps');
var babel = require('gulp-babel');
var tslint = require('gulp-tslint');
const tslintOptions = {
configuration: "tslint.json",
formatter: "stylish",
formattersDirectory: null,
rulesDirectory: null,
tslint: null,
program: null
};
const tslintReportOptions = {
emitError: false,
reportLimit: 0,
summarizeFailureOutput: false
};
gulp.task('scripts', function () {
var tsResult = tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject(ts.reporter.longReporter()));
// Merge the two output streams, so this task is finished when the IO of both operations is done.
return merge([
tsResult.dts.pipe(gulp.dest('dist')),
tsResult.js
.pipe(babel({
presets: [ 'es2015' ]
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'))
]);
});
gulp.task('lint', function () {
gulp.src('source/**/*.ts')
.pipe(tslint(tslintOptions))
.pipe(tslint.report(tslintReportOptions));
});
gulp.task('default', [ 'scripts', 'lint' ], function () {
gulp.watch('source/**/*.ts', [ 'scripts', 'lint' ]);
});