@@ -69,12 +69,12 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
6969} ) ;
7070
7171var _exampleBoilerplateFiles = [
72- 'karma.conf.js' ,
73- 'karma-test-shim.js' ,
74- 'package.json' ,
75- 'styles.css' ,
76- 'tsconfig.json' ,
77- 'typings.json'
72+ 'karma.conf.js' ,
73+ 'karma-test-shim.js' ,
74+ 'package.json' ,
75+ 'styles.css' ,
76+ 'tsconfig.json' ,
77+ 'typings.json'
7878 ] ;
7979
8080var _exampleDartWebBoilerPlateFiles = [ 'styles.css' ] ;
@@ -153,14 +153,17 @@ function findAndRunE2eTests(filter) {
153153// to the outputFile.
154154function runE2eTests ( appDir , protractorConfigFilename , outputFile ) {
155155 // start the app
156- var appRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'http-server' , '--' , '-s' ] , { cwd : appDir } ) ;
157-
158- // start protractor
159- var pcFilename = path . resolve ( protractorConfigFilename ) ; // need to resolve because we are going to be running from a different dir
160- var exePath = path . join ( process . cwd ( ) , "./node_modules/.bin/" ) ;
161- var spawnInfo = spawnExt ( 'protractor' ,
162- [ pcFilename , '--params.appDir=' + appDir , '--params.outputFile=' + outputFile ] , { cwd : exePath } ) ;
163- return spawnInfo . promise . then ( function ( data ) {
156+ var appRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'http-server:e2e' , '--' , '-s' ] , { cwd : appDir } ) ;
157+ var tscRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'tsc' ] , { cwd : appDir } ) ;
158+
159+ return tscRunSpawnInfo . promise . then ( function ( data ) {
160+ // start protractor
161+ var pcFilename = path . resolve ( protractorConfigFilename ) ; // need to resolve because we are going to be running from a different dir
162+ var exePath = path . join ( process . cwd ( ) , "./node_modules/.bin/" ) ;
163+ var spawnInfo = spawnExt ( 'protractor' ,
164+ [ pcFilename , '--params.appDir=' + appDir , '--params.outputFile=' + outputFile ] , { cwd : exePath } ) ;
165+ return spawnInfo . promise ;
166+ } ) . then ( function ( data ) {
164167 // kill the app now that protractor has completed.
165168 // Ugh... proc.kill does not work properly on windows with child processes.
166169 // appRun.proc.kill();
@@ -243,14 +246,14 @@ gulp.task('add-example-boilerplate', function() {
243246 gutil . log ( "symlinking " + linkPath + ' -> ' + realPath )
244247 fsUtils . addSymlink ( realPath , linkPath ) ;
245248 } ) ;
246-
249+
247250 realPath = path . join ( EXAMPLES_PATH , '/typings' ) ;
248251 var typingsPaths = getTypingsPaths ( EXAMPLES_PATH ) ;
249252 typingsPaths . forEach ( function ( linkPath ) {
250- gutil . log ( "symlinking " + linkPath + ' -> ' + realPath )
253+ gutil . log ( "symlinking " + linkPath + ' -> ' + realPath )
251254 fsUtils . addSymlink ( realPath , linkPath ) ;
252255 } ) ;
253-
256+
254257 return copyExampleBoilerplate ( ) ;
255258} ) ;
256259
@@ -263,7 +266,7 @@ function copyExampleBoilerplate() {
263266 return path . join ( EXAMPLES_PATH , fn ) ;
264267 } ) ;
265268 var examplePaths = getExamplePaths ( EXAMPLES_PATH ) ;
266-
269+
267270 var dartWebSourceFiles = _exampleDartWebBoilerPlateFiles . map ( function ( fn ) {
268271 return path . join ( EXAMPLES_PATH , fn ) ;
269272 } ) ;
@@ -287,15 +290,15 @@ gulp.task('remove-example-boilerplate', function() {
287290 nodeModulesPaths . forEach ( function ( linkPath ) {
288291 fsUtils . removeSymlink ( linkPath ) ;
289292 } ) ;
290-
293+
291294 var typingsPaths = getTypingsPaths ( EXAMPLES_PATH ) ;
292295 typingsPaths . forEach ( function ( linkPath ) {
293296 fsUtils . removeSymlink ( linkPath ) ;
294- } ) ;
295-
297+ } ) ;
298+
296299 var examplePaths = getExamplePaths ( EXAMPLES_PATH ) ;
297300 var dartExampleWebPaths = getDartExampleWebPaths ( EXAMPLES_PATH ) ;
298-
301+
299302 return deleteFiles ( _exampleBoilerplateFiles , examplePaths )
300303 . then ( function ( ) {
301304 return deleteFiles ( _exampleDartWebBoilerPlateFiles , dartExampleWebPaths ) ;
@@ -346,7 +349,7 @@ gulp.task('build-js-api-docs', ['_shred-api-examples'], function() {
346349} ) ;
347350
348351gulp . task ( 'build-plunkers' , function ( ) {
349- return copyExampleBoilerplate ( )
352+ return copyExampleBoilerplate ( )
350353 . then ( function ( ) {
351354 return plunkerBuilder . buildPlunkers ( EXAMPLES_PATH , LIVE_EXAMPLES_PATH , { errFn : gutil . log } ) ;
352355 } ) ;
@@ -501,7 +504,7 @@ function harpCompile() {
501504 vars : { NODE_ENV : "production" }
502505 } ) ;
503506 gutil . log ( "NODE_ENV: " + process . env . NODE_ENV ) ;
504-
507+
505508 var deferred = Q . defer ( ) ;
506509 gutil . log ( 'running harp compile...' ) ;
507510 showHideExampleNodeModules ( 'hide' ) ;
@@ -523,20 +526,20 @@ function harpCompile() {
523526}
524527
525528function linkChecker ( options ) {
526- var deferred = Q . defer ( ) ;
529+ var deferred = Q . defer ( ) ;
527530 var options = options || { } ;
528-
531+
529532 var blcOptions = options . blcOptions || { } ;
530533 var customData = options . customData || { } ;
531-
534+
532535 var excludeBad ; // don't bother reporting bad links matching this RegExp
533536 if ( argv . excludeBad ) {
534537 excludeBad = new RegExp ( argv . excludeBad ) ;
535538 } else {
536539 excludeBad = options . excludeBad === undefined ? / d o c s \/ d a r t \/ l a t e s t \/ a p i / : '' ;
537540 }
538-
539- var previousPage ;
541+
542+ var previousPage ;
540543 var siteUrl = argv . url || options . url || 'https://angular.io/' ;
541544
542545 // See https://github.com/stevenvachon/broken-link-checker#blcsitecheckeroptions-handlers
@@ -546,12 +549,12 @@ function linkChecker(options) {
546549 //gutil.log('Scanning ' + pageUrl);docs/ts/latest/api/core/
547550 } ,
548551 junk : function ( result , customData ) { } ,
549-
552+
550553 // Analyze links
551554 link : function ( result , customData ) {
552555 if ( ! result . broken ) { return ; }
553556 if ( excludeBad && excludeBad . test ( result . url . resolved ) ) { return ; }
554-
557+
555558 var currentPage = result . base . resolved
556559 if ( previousPage !== currentPage ) {
557560 previousPage = currentPage ;
@@ -563,10 +566,10 @@ function linkChecker(options) {
563566 //gutil.log(msg);
564567 //gutil.log(result);
565568 } ,
566-
569+
567570 page : function ( error , pageUrl , customData ) { } ,
568571 site : function ( error , siteUrl , customData ) { } ,
569-
572+
570573 end : function ( ) {
571574 var stopTime = new Date ( ) . getTime ( ) ;
572575 var elapsed = 'Elapsed link-checking time: ' + ( ( stopTime - startTime ) / 1000 ) + ' seconds' ;
@@ -576,24 +579,24 @@ function linkChecker(options) {
576579 deferred . resolve ( true ) ;
577580 }
578581 } ;
579-
582+
580583 // create an output file with header.
581584 var outputFile = path . join ( process . cwd ( ) , 'link-checker-results.txt' ) ;
582585 var header = 'Link checker results for: ' + siteUrl +
583- '\nStarted: ' + ( new Date ( ) ) . toLocaleString ( ) +
586+ '\nStarted: ' + ( new Date ( ) ) . toLocaleString ( ) +
584587 '\nSkipping bad links matching regex: ' + excludeBad . toString ( ) + '\n\n' ;
585588 gutil . log ( header ) ;
586589 fs . writeFileSync ( outputFile , header ) ;
587-
590+
588591 var siteChecker = new blc . SiteChecker ( blcOptions , handlers ) ;
589592 var startTime = new Date ( ) . getTime ( ) ;
590-
591- try {
593+
594+ try {
592595 siteChecker . enqueue ( siteUrl , customData ) ;
593596 } catch ( err ) {
594597 deferred . reject ( err ) ;
595- }
596- return deferred . promise ;
598+ }
599+ return deferred . promise ;
597600}
598601
599602// harp has issues with node_modules under the public dir
@@ -701,7 +704,7 @@ function watchAndSync(options, cb) {
701704 env ( {
702705 vars : { NODE_ENV : "production" }
703706 } ) ;
704-
707+
705708 execCommands ( [ 'npm run harp -- server .' ] , { } , cb ) ;
706709
707710 var browserSync = require ( 'browser-sync' ) . create ( ) ;
@@ -781,7 +784,7 @@ function apiExamplesWatch(postShredAction) {
781784
782785function devGuideExamplesWatch ( shredOptions , postShredAction ) {
783786 var includePattern = path . join ( shredOptions . examplesDir , '**/*.*' ) ;
784- // removed this version because gulp.watch has the same glob issue that dgeni has.
787+ // removed this version because gulp.watch has the same glob issue that dgeni has.
785788 // var excludePattern = '!' + path.join(shredOptions.examplesDir, '**/node_modules/**/*.*');
786789 // gulp.watch([includePattern, excludePattern], {readDelay: 500}, function (event, done) {
787790 var files = globby . sync ( [ includePattern ] , { ignore : [ '**/node_modules/**' , '**/_fragments/**' ] } ) ;
@@ -989,7 +992,7 @@ function execCommands(cmds, options, cb) {
989992 if ( ! cmds || cmds . length == 0 ) cb ( null , null , null ) ;
990993 var exec = require ( 'child_process' ) . exec ; // just to make it more portable.
991994 gutil . log ( "NODE_ENV: " + process . env . NODE_ENV ) ;
992-
995+
993996 exec ( cmds [ 0 ] , options , function ( err , stdout , stderr ) {
994997 if ( err == null ) {
995998 if ( options . shouldLog ) {
@@ -1019,4 +1022,3 @@ function checkAngularProjectPath() {
10191022 throw new Error ( 'API related tasks require the angular2 repo to be at ' + path . resolve ( ANGULAR_PROJECT_PATH ) ) ;
10201023 }
10211024}
1022-
0 commit comments