@@ -69,12 +69,12 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
69
69
} ) ;
70
70
71
71
var _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'
78
78
] ;
79
79
80
80
var _exampleDartWebBoilerPlateFiles = [ 'styles.css' ] ;
@@ -153,14 +153,17 @@ function findAndRunE2eTests(filter) {
153
153
// to the outputFile.
154
154
function runE2eTests ( appDir , protractorConfigFilename , outputFile ) {
155
155
// 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 ) {
164
167
// kill the app now that protractor has completed.
165
168
// Ugh... proc.kill does not work properly on windows with child processes.
166
169
// appRun.proc.kill();
@@ -243,14 +246,14 @@ gulp.task('add-example-boilerplate', function() {
243
246
gutil . log ( "symlinking " + linkPath + ' -> ' + realPath )
244
247
fsUtils . addSymlink ( realPath , linkPath ) ;
245
248
} ) ;
246
-
249
+
247
250
realPath = path . join ( EXAMPLES_PATH , '/typings' ) ;
248
251
var typingsPaths = getTypingsPaths ( EXAMPLES_PATH ) ;
249
252
typingsPaths . forEach ( function ( linkPath ) {
250
- gutil . log ( "symlinking " + linkPath + ' -> ' + realPath )
253
+ gutil . log ( "symlinking " + linkPath + ' -> ' + realPath )
251
254
fsUtils . addSymlink ( realPath , linkPath ) ;
252
255
} ) ;
253
-
256
+
254
257
return copyExampleBoilerplate ( ) ;
255
258
} ) ;
256
259
@@ -263,7 +266,7 @@ function copyExampleBoilerplate() {
263
266
return path . join ( EXAMPLES_PATH , fn ) ;
264
267
} ) ;
265
268
var examplePaths = getExamplePaths ( EXAMPLES_PATH ) ;
266
-
269
+
267
270
var dartWebSourceFiles = _exampleDartWebBoilerPlateFiles . map ( function ( fn ) {
268
271
return path . join ( EXAMPLES_PATH , fn ) ;
269
272
} ) ;
@@ -287,15 +290,15 @@ gulp.task('remove-example-boilerplate', function() {
287
290
nodeModulesPaths . forEach ( function ( linkPath ) {
288
291
fsUtils . removeSymlink ( linkPath ) ;
289
292
} ) ;
290
-
293
+
291
294
var typingsPaths = getTypingsPaths ( EXAMPLES_PATH ) ;
292
295
typingsPaths . forEach ( function ( linkPath ) {
293
296
fsUtils . removeSymlink ( linkPath ) ;
294
- } ) ;
295
-
297
+ } ) ;
298
+
296
299
var examplePaths = getExamplePaths ( EXAMPLES_PATH ) ;
297
300
var dartExampleWebPaths = getDartExampleWebPaths ( EXAMPLES_PATH ) ;
298
-
301
+
299
302
return deleteFiles ( _exampleBoilerplateFiles , examplePaths )
300
303
. then ( function ( ) {
301
304
return deleteFiles ( _exampleDartWebBoilerPlateFiles , dartExampleWebPaths ) ;
@@ -346,7 +349,7 @@ gulp.task('build-js-api-docs', ['_shred-api-examples'], function() {
346
349
} ) ;
347
350
348
351
gulp . task ( 'build-plunkers' , function ( ) {
349
- return copyExampleBoilerplate ( )
352
+ return copyExampleBoilerplate ( )
350
353
. then ( function ( ) {
351
354
return plunkerBuilder . buildPlunkers ( EXAMPLES_PATH , LIVE_EXAMPLES_PATH , { errFn : gutil . log } ) ;
352
355
} ) ;
@@ -501,7 +504,7 @@ function harpCompile() {
501
504
vars : { NODE_ENV : "production" }
502
505
} ) ;
503
506
gutil . log ( "NODE_ENV: " + process . env . NODE_ENV ) ;
504
-
507
+
505
508
var deferred = Q . defer ( ) ;
506
509
gutil . log ( 'running harp compile...' ) ;
507
510
showHideExampleNodeModules ( 'hide' ) ;
@@ -523,20 +526,20 @@ function harpCompile() {
523
526
}
524
527
525
528
function linkChecker ( options ) {
526
- var deferred = Q . defer ( ) ;
529
+ var deferred = Q . defer ( ) ;
527
530
var options = options || { } ;
528
-
531
+
529
532
var blcOptions = options . blcOptions || { } ;
530
533
var customData = options . customData || { } ;
531
-
534
+
532
535
var excludeBad ; // don't bother reporting bad links matching this RegExp
533
536
if ( argv . excludeBad ) {
534
537
excludeBad = new RegExp ( argv . excludeBad ) ;
535
538
} else {
536
539
excludeBad = options . excludeBad === undefined ? / d o c s \/ d a r t \/ l a t e s t \/ a p i / : '' ;
537
540
}
538
-
539
- var previousPage ;
541
+
542
+ var previousPage ;
540
543
var siteUrl = argv . url || options . url || 'https://angular.io/' ;
541
544
542
545
// See https://github.com/stevenvachon/broken-link-checker#blcsitecheckeroptions-handlers
@@ -546,12 +549,12 @@ function linkChecker(options) {
546
549
//gutil.log('Scanning ' + pageUrl);docs/ts/latest/api/core/
547
550
} ,
548
551
junk : function ( result , customData ) { } ,
549
-
552
+
550
553
// Analyze links
551
554
link : function ( result , customData ) {
552
555
if ( ! result . broken ) { return ; }
553
556
if ( excludeBad && excludeBad . test ( result . url . resolved ) ) { return ; }
554
-
557
+
555
558
var currentPage = result . base . resolved
556
559
if ( previousPage !== currentPage ) {
557
560
previousPage = currentPage ;
@@ -563,10 +566,10 @@ function linkChecker(options) {
563
566
//gutil.log(msg);
564
567
//gutil.log(result);
565
568
} ,
566
-
569
+
567
570
page : function ( error , pageUrl , customData ) { } ,
568
571
site : function ( error , siteUrl , customData ) { } ,
569
-
572
+
570
573
end : function ( ) {
571
574
var stopTime = new Date ( ) . getTime ( ) ;
572
575
var elapsed = 'Elapsed link-checking time: ' + ( ( stopTime - startTime ) / 1000 ) + ' seconds' ;
@@ -576,24 +579,24 @@ function linkChecker(options) {
576
579
deferred . resolve ( true ) ;
577
580
}
578
581
} ;
579
-
582
+
580
583
// create an output file with header.
581
584
var outputFile = path . join ( process . cwd ( ) , 'link-checker-results.txt' ) ;
582
585
var header = 'Link checker results for: ' + siteUrl +
583
- '\nStarted: ' + ( new Date ( ) ) . toLocaleString ( ) +
586
+ '\nStarted: ' + ( new Date ( ) ) . toLocaleString ( ) +
584
587
'\nSkipping bad links matching regex: ' + excludeBad . toString ( ) + '\n\n' ;
585
588
gutil . log ( header ) ;
586
589
fs . writeFileSync ( outputFile , header ) ;
587
-
590
+
588
591
var siteChecker = new blc . SiteChecker ( blcOptions , handlers ) ;
589
592
var startTime = new Date ( ) . getTime ( ) ;
590
-
591
- try {
593
+
594
+ try {
592
595
siteChecker . enqueue ( siteUrl , customData ) ;
593
596
} catch ( err ) {
594
597
deferred . reject ( err ) ;
595
- }
596
- return deferred . promise ;
598
+ }
599
+ return deferred . promise ;
597
600
}
598
601
599
602
// harp has issues with node_modules under the public dir
@@ -701,7 +704,7 @@ function watchAndSync(options, cb) {
701
704
env ( {
702
705
vars : { NODE_ENV : "production" }
703
706
} ) ;
704
-
707
+
705
708
execCommands ( [ 'npm run harp -- server .' ] , { } , cb ) ;
706
709
707
710
var browserSync = require ( 'browser-sync' ) . create ( ) ;
@@ -781,7 +784,7 @@ function apiExamplesWatch(postShredAction) {
781
784
782
785
function devGuideExamplesWatch ( shredOptions , postShredAction ) {
783
786
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.
785
788
// var excludePattern = '!' + path.join(shredOptions.examplesDir, '**/node_modules/**/*.*');
786
789
// gulp.watch([includePattern, excludePattern], {readDelay: 500}, function (event, done) {
787
790
var files = globby . sync ( [ includePattern ] , { ignore : [ '**/node_modules/**' , '**/_fragments/**' ] } ) ;
@@ -989,7 +992,7 @@ function execCommands(cmds, options, cb) {
989
992
if ( ! cmds || cmds . length == 0 ) cb ( null , null , null ) ;
990
993
var exec = require ( 'child_process' ) . exec ; // just to make it more portable.
991
994
gutil . log ( "NODE_ENV: " + process . env . NODE_ENV ) ;
992
-
995
+
993
996
exec ( cmds [ 0 ] , options , function ( err , stdout , stderr ) {
994
997
if ( err == null ) {
995
998
if ( options . shouldLog ) {
@@ -1019,4 +1022,3 @@ function checkAngularProjectPath() {
1019
1022
throw new Error ( 'API related tasks require the angular2 repo to be at ' + path . resolve ( ANGULAR_PROJECT_PATH ) ) ;
1020
1023
}
1021
1024
}
1022
-
0 commit comments