-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
40 lines (35 loc) · 1.28 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
var gulp = require("gulp");
var ts = require("gulp-typescript");
var mocha = require('gulp-mocha');
var tsProject = ts.createProject("tsconfig.json");
var sourcemaps = require("gulp-sourcemaps");
var del = require("del");
var path = require("path");
/* Test Tasks
WARNING: GULP MOCHA task is a work in progress and currently has issue.
NPM Script "Test" (package.json) currently more reliable
*/
gulp.task('test', function(){
return gulp.src('./test/**/*.ts')
.pipe(tsProject()).js
.pipe(gulp.dest('.'))
.pipe(mocha({
reporter: 'progress'
}))
})
/* Cleanup the DIST folder before compiling */
gulp.task('clean', function(){
return del('dist/**/*');
})
/* Compile the Typescript */
/* IMPORTANT: The Sourcemaps settings here are important or the sourcemap url and source path in the source
maps will not be correct and your breakpoints will not hit - this is especially important for subfolders in the dist folder */
gulp.task('compile', ['clean'], function () {
var result = tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject()).js
.pipe(sourcemaps.write('.', {includeContent:false, sourceRoot: '.'}))
.pipe(gulp.dest('dist'));
});
/* The default task will allow us to just run "gulp" from the command line to build everything */
gulp.task('default', ['compile']);