11/**
2- * Copyright (C) 2016 Michael Kourlas
2+ * Copyright (C) 2016-2017 Michael Kourlas
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1616
1717"use strict" ;
1818
19- var doc = require ( "gulp-typedoc" ) ;
19+ var del = require ( "del" ) ;
20+ var typedoc = require ( "gulp-typedoc" ) ;
2021var gulp = require ( "gulp" ) ;
2122var merge2 = require ( "merge2" ) ;
2223var mocha = require ( "gulp-mocha" ) ;
2324var sourcemaps = require ( 'gulp-sourcemaps' ) ;
24- var ts = require ( "gulp-typescript" ) ;
25+ var typescript = require ( "gulp-typescript" ) ;
2526var tslint = require ( "gulp-tslint" ) ;
2627
2728gulp . task ( "default" , [ "prod" , "test-prod" , "docs" ] ) ;
2829
29- var tsProject = ts . createProject ( "tsconfig.json" ) ;
30- gulp . task ( "prod" , function ( ) {
30+ gulp . task ( "clean" , function ( ) {
31+ return del ( "lib" ) ;
32+ } ) ;
33+
34+ gulp . task ( "clean-docs" , function ( ) {
35+ return del ( "docs" ) ;
36+ } ) ;
37+
38+ var tsProject = typescript . createProject ( "tsconfig.json" ) ;
39+ gulp . task ( "prod" , [ "clean" ] , function ( ) {
3140 var tsResult = tsProject . src ( )
3241 . pipe ( tslint ( ) )
3342 . pipe ( tslint . report ( ) )
34- . pipe ( tsProject ( ts . reporter . longReporter ( ) ) ) ;
43+ . pipe ( tsProject ( ) )
44+ . on ( "error" , function ( ) {
45+ this . on ( "finish" , function ( ) {
46+ // Commented out pending resolution
47+ // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/14324
48+ // process.exit(1);
49+ } ) ;
50+ } ) ;
3551 return merge2 ( [ tsResult . js
3652 . pipe ( gulp . dest ( "lib" ) ) ,
3753 tsResult . dts
3854 . pipe ( gulp . dest ( "lib" ) ) ] ) ;
3955} ) ;
40- gulp . task ( "dev" , function ( ) {
56+ gulp . task ( "dev" , [ "clean" ] , function ( ) {
4157 var tsResult = tsProject . src ( )
4258 . pipe ( tslint ( ) )
4359 . pipe ( tslint . report ( ) )
4460 . pipe ( sourcemaps . init ( ) )
45- . pipe ( tsProject ( ts . reporter . longReporter ( ) ) ) ;
61+ . pipe ( tsProject ( ) )
62+ . on ( "error" , function ( ) {
63+ this . on ( "finish" , function ( ) {
64+ // Commented out pending resolution
65+ // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/14324
66+ // process.exit(1);
67+ } ) ;
68+ } ) ;
4669 return merge2 ( [ tsResult . js
4770 . pipe ( sourcemaps . write ( ) )
4871 . pipe ( gulp . dest ( "lib" ) ) ,
4972 tsResult . dts
5073 . pipe ( gulp . dest ( "lib" ) ) ] ) ;
5174} ) ;
5275
53- var testTsProject = ts . createProject ( "test/tsconfig.json" ) ;
76+ var testTsProject = typescript . createProject ( "test/tsconfig.json" ) ;
5477var test = function ( ) {
5578 return testTsProject . src ( )
5679 . pipe ( tslint ( ) )
5780 . pipe ( tslint . report ( ) )
5881 . pipe ( sourcemaps . init ( ) )
59- . pipe ( testTsProject ( ts . reporter . longReporter ( ) ) )
82+ . pipe ( testTsProject ( ) )
83+ . on ( "error" , function ( ) {
84+ this . on ( "finish" , function ( ) {
85+ // Commented out pending resolution
86+ // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/14324
87+ // process.exit(1);
88+ } ) ;
89+ } )
6090 . pipe ( sourcemaps . write ( ) )
6191 . pipe ( gulp . dest ( "test/lib" ) )
6292 . pipe ( mocha ( ) ) ;
@@ -69,11 +99,9 @@ var docOptions = {
6999 mode : "file" ,
70100 module : "commonjs" ,
71101 out : "docs" ,
72- target : "es5" ,
73- // TODO: Remove this option once TypeDoc supports TypeScript 2.0
74- ignoreCompilerErrors : true
102+ target : "es5"
75103} ;
76- gulp . task ( "docs" , function ( ) {
104+ gulp . task ( "docs" , [ "prod" , "clean-docs" ] , function ( ) {
77105 return gulp . src ( "src" )
78- . pipe ( doc ( docOptions ) ) ;
106+ . pipe ( typedoc ( docOptions ) ) ;
79107} ) ;
0 commit comments