@@ -84,26 +84,23 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
84
84
} ) ;
85
85
86
86
var _exampleBoilerplateFiles = [
87
- 'a2docs.css' ,
87
+ 'src/styles.css' ,
88
+ 'src/systemjs.config.js' ,
89
+ 'src/tsconfig.json' ,
90
+ 'bs-config.json' ,
91
+ 'bs-config.e2e.json' ,
88
92
'package.json' ,
89
- 'styles.css' ,
90
- 'systemjs.config.js' ,
91
- 'tsconfig.json' ,
92
93
'tslint.json'
93
94
] ;
94
95
95
- var _exampleDartWebBoilerPlateFiles = [ 'a2docs.css' , 'styles.css' ] ;
96
-
97
96
var _exampleUnitTestingBoilerplateFiles = [
98
- 'browser-test-shim.js' ,
97
+ 'src/ browser-test-shim.js' ,
99
98
'karma-test-shim.js' ,
100
99
'karma.conf.js'
101
100
] ;
102
101
103
102
var _exampleConfigFilename = 'example-config.json' ;
104
103
105
- var _styleLessName = 'a2docs.less' ;
106
-
107
104
// Gulp flags:
108
105
//
109
106
// --lang=[all | ts | js | dart | 'ts|js' | 'ts|js|dart' | ...]
@@ -182,21 +179,12 @@ function runE2e() {
182
179
// fast; skip all setup
183
180
promise = Promise . resolve ( true ) ;
184
181
} else {
185
- /*
186
- // Not 'fast'; do full setup
187
- var spawnInfo = spawnExt('npm', ['install'], { cwd: EXAMPLES_PATH});
188
- promise = spawnInfo.promise.then(function() {
189
- copyExampleBoilerplate();
190
- spawnInfo = spawnExt('npm', ['run', 'webdriver:update'], {cwd: EXAMPLES_PATH});
191
- return spawnInfo.promise;
192
- });
193
- */
194
182
// Not 'fast'; do full setup
195
183
gutil . log ( 'runE2e: install _examples stuff' ) ;
196
184
var spawnInfo = spawnExt ( 'npm' , [ 'install' ] , { cwd : EXAMPLES_PATH } ) ;
197
185
promise = spawnInfo . promise
186
+ . then ( copyExampleBoilerplate )
198
187
. then ( function ( ) {
199
- buildStyles ( copyExampleBoilerplate , _ . noop ) ;
200
188
gutil . log ( 'runE2e: update webdriver' ) ;
201
189
spawnInfo = spawnExt ( 'npm' , [ 'run' , 'webdriver:update' ] , { cwd : EXAMPLES_PATH } ) ;
202
190
return spawnInfo . promise ;
@@ -283,8 +271,8 @@ function runE2eTsTests(appDir, outputFile) {
283
271
}
284
272
285
273
var config = {
286
- build : exampleConfig . build || 'tsc ' ,
287
- run : exampleConfig . run || 'http-server :e2e'
274
+ build : exampleConfig . build || 'build ' ,
275
+ run : exampleConfig . run || 'serve :e2e'
288
276
} ;
289
277
290
278
var appBuildSpawnInfo = spawnExt ( 'npm' , [ 'run' , config . build ] , { cwd : appDir } ) ;
@@ -350,7 +338,7 @@ function runProtractorAoT(appDir, outputFile) {
350
338
promise = promise . then ( ( ) =>
351
339
spawnExt ( 'node' , [ copyFileCmd ] , { cwd : appDir } ) . promise ) ;
352
340
}
353
- var aotRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'http-server:e2e' , ' aot' , '--' , '-s '] , { cwd : appDir } ) ;
341
+ var aotRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'serve: aot' ] , { cwd : appDir } ) ;
354
342
return runProtractor ( promise , appDir , aotRunSpawnInfo , outputFile ) ;
355
343
}
356
344
@@ -364,7 +352,7 @@ function runE2eDartTests(appDir, outputFile) {
364
352
gutil . log ( 'AppDir for Dart e2e: ' + appDir ) ;
365
353
gutil . log ( 'Deploying from: ' + deployDir ) ;
366
354
367
- var appRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'http-server :e2e' , '--' , deployDir , '-s' ] , { cwd : httpLaunchDir } ) ;
355
+ var appRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'serve :e2e' , '--' , deployDir , '-s' ] , { cwd : httpLaunchDir } ) ;
368
356
if ( ! appRunSpawnInfo . proc . pid ) {
369
357
gutil . log ( 'http-server failed to launch over ' + deployDir ) ;
370
358
return false ;
@@ -448,7 +436,7 @@ gulp.task('help', taskListing.withFilters(function(taskName) {
448
436
} ) ) ;
449
437
450
438
// requires admin access because it adds symlinks
451
- gulp . task ( 'add-example-boilerplate' , function ( done ) {
439
+ gulp . task ( 'add-example-boilerplate' , function ( ) {
452
440
var realPath = path . join ( EXAMPLES_PATH , '/node_modules' ) ;
453
441
var nodeModulesPaths = excludeDartPaths ( getNodeModulesPaths ( EXAMPLES_PATH ) ) ;
454
442
@@ -457,55 +445,31 @@ gulp.task('add-example-boilerplate', function(done) {
457
445
fsUtils . addSymlink ( realPath , linkPath ) ;
458
446
} ) ;
459
447
460
- return buildStyles ( copyExampleBoilerplate , done ) ;
448
+ return copyExampleBoilerplate ( ) ;
461
449
} ) ;
462
450
463
451
464
452
// copies boilerplate files to locations
465
453
// where an example app is found
466
454
gulp . task ( '_copy-example-boilerplate' , function ( done ) {
467
- return argv . fast ? done ( ) : buildStyles ( copyExampleBoilerplate , done ) ;
455
+ return argv . fast ? done ( ) : copyExampleBoilerplate ( ) ;
468
456
} ) ;
469
457
470
- //Builds Angular Docs CSS file from Bootstrap npm LESS source
471
- //and copies the result to the _examples folder to be included as
472
- //part of the example boilerplate.
473
- function buildStyles ( cb , done ) {
474
- gulp . src ( path . join ( STYLES_SOURCE_PATH , _styleLessName ) )
475
- . pipe ( less ( ) )
476
- . pipe ( gulp . dest ( BOILERPLATE_PATH ) ) . on ( 'end' , function ( ) {
477
- cb ( ) . then ( function ( ) { done ( ) ; } ) ;
478
- } ) ;
479
- }
480
-
481
458
// copies boilerplate files to locations
482
459
// where an example app is found
483
460
// also copies certain web files (e.g., styles.css) to ~/_examples/**/dart/**/web
484
461
function copyExampleBoilerplate ( ) {
485
462
gutil . log ( 'Copying example boilerplate files' ) ;
486
- var sourceFiles = _exampleBoilerplateFiles . map ( function ( fn ) {
487
- return path . join ( BOILERPLATE_PATH , fn ) ;
488
- } ) ;
489
463
var examplePaths = excludeDartPaths ( getExamplePaths ( EXAMPLES_PATH ) ) ;
490
464
491
- var dartWebSourceFiles = _exampleDartWebBoilerPlateFiles . map ( function ( fn ) {
492
- return path . join ( BOILERPLATE_PATH , fn ) ;
493
- } ) ;
494
- var dartExampleWebPaths = getDartExampleWebPaths ( EXAMPLES_PATH ) ;
495
-
496
465
// Make boilerplate files read-only to avoid that they be edited by mistake.
497
466
var destFileMode = '444' ;
498
- return copyFiles ( sourceFiles , examplePaths , destFileMode )
499
- . then ( function ( ) {
500
- return copyFiles ( dartWebSourceFiles , dartExampleWebPaths , destFileMode ) ;
501
- } )
467
+ return copyFiles ( _exampleBoilerplateFiles , BOILERPLATE_PATH , examplePaths , destFileMode )
502
468
// copy the unit test boilerplate
503
469
. then ( function ( ) {
504
- var unittestSourceFiles =
505
- _exampleUnitTestingBoilerplateFiles
506
- . map ( function ( name ) { return path . join ( EXAMPLES_TESTING_PATH , name ) ; } ) ;
507
470
var unittestPaths = getUnitTestingPaths ( EXAMPLES_PATH ) ;
508
- return copyFiles ( unittestSourceFiles , unittestPaths , destFileMode ) ;
471
+ return copyFiles ( _exampleUnitTestingBoilerplateFiles ,
472
+ EXAMPLES_TESTING_PATH , unittestPaths , destFileMode ) ;
509
473
} )
510
474
. catch ( function ( err ) {
511
475
gutil . log ( err ) ;
@@ -582,9 +546,6 @@ function deleteExampleBoilerPlate() {
582
546
var unittestPaths = getUnitTestingPaths ( EXAMPLES_PATH ) ;
583
547
584
548
return deleteFiles ( _exampleBoilerplateFiles , examplePaths )
585
- . then ( function ( ) {
586
- return deleteFiles ( _exampleDartWebBoilerPlateFiles , dartExampleWebPaths ) ;
587
- } )
588
549
. then ( function ( ) {
589
550
return deleteFiles ( _exampleUnitTestingBoilerplateFiles , unittestPaths ) ;
590
551
} ) ;
@@ -1053,15 +1014,15 @@ function harpJsonSetJade2NgTo(v) {
1053
1014
// Copies fileNames into destPaths, setting the mode of the
1054
1015
// files at the destination as optional_destFileMode if given.
1055
1016
// returns a promise
1056
- function copyFiles ( fileNames , destPaths , optional_destFileMode ) {
1017
+ function copyFiles ( fileNames , originPath , destPaths , optional_destFileMode ) {
1057
1018
var copy = Q . denodeify ( fsExtra . copy ) ;
1058
1019
var chmod = Q . denodeify ( fsExtra . chmod ) ;
1059
1020
var copyPromises = [ ] ;
1060
1021
destPaths . forEach ( function ( destPath ) {
1061
1022
fileNames . forEach ( function ( fileName ) {
1062
- var baseName = path . basename ( fileName ) ;
1063
- var destName = path . join ( destPath , baseName ) ;
1064
- var p = copy ( fileName , destName , { clobber : true } ) ;
1023
+ var originName = path . join ( originPath , fileName ) ;
1024
+ var destName = path . join ( destPath , fileName ) ;
1025
+ var p = copy ( originName , destName , { clobber : true } ) ;
1065
1026
if ( optional_destFileMode !== undefined ) {
1066
1027
p = p . then ( function ( ) {
1067
1028
return chmod ( destName , optional_destFileMode ) ;
0 commit comments