@@ -345,6 +345,18 @@ export class Extractor {
345345 }
346346 }
347347
348+ this . _generateRollupDtsFiles ( context ) ;
349+
350+ if ( this . _localBuild ) {
351+ // For a local build, fail if there were errors (but ignore warnings)
352+ return this . _monitoredLogger . errorCount === 0 ;
353+ } else {
354+ // For a production build, fail if there were any errors or warnings
355+ return ( this . _monitoredLogger . errorCount + this . _monitoredLogger . warningCount ) === 0 ;
356+ }
357+ }
358+
359+ private _generateRollupDtsFiles ( context : ExtractorContext ) : void {
348360 const dtsRollup : IExtractorDtsRollupConfig = this . actualConfig . dtsRollup ! ;
349361 if ( dtsRollup . enabled ) {
350362 let mainDtsRollupPath : string = dtsRollup . mainDtsRollupPath ! ;
@@ -354,27 +366,26 @@ export class Extractor {
354366 if ( ! context . packageJson . typings ) {
355367 this . _monitoredLogger . logError ( 'Either the "mainDtsRollupPath" setting must be specified,'
356368 + ' or else the package.json file must contain a "typings" field.' ) ;
357- return false ;
369+ return ;
358370 }
359371
360372 // Resolve the "typings" field relative to package.json itself
361- const resolvedTypings : string = path . resolve ( context . packageFolder ,
362- context . packageJson . typings ) ;
373+ const resolvedTypings : string = path . resolve ( context . packageFolder , context . packageJson . typings ) ;
363374
364375 if ( dtsRollup . trimming ) {
365376 if ( ! Path . isUnder ( resolvedTypings , dtsRollup . publishFolderForInternal ! ) ) {
366377 this . _monitoredLogger . logError ( 'The "mainDtsRollupPath" setting was not specified.'
367378 + ' In this case, the package.json "typings" field must point to a file under'
368379 + ' the "publishFolderForInternal": ' + dtsRollup . publishFolderForInternal ! ) ;
369- return false ;
380+ return ;
370381 }
371382 mainDtsRollupPath = path . relative ( dtsRollup . publishFolderForInternal ! , resolvedTypings ) ;
372383 } else {
373384 if ( ! Path . isUnder ( resolvedTypings , dtsRollup . publishFolder ! ) ) {
374385 this . _monitoredLogger . logError ( 'The "mainDtsRollupPath" setting was not specified.'
375386 + ' In this case, the package.json "typings" field must point to a file under'
376387 + ' the "publishFolder": ' + dtsRollup . publishFolder ! ) ;
377- return false ;
388+ return ;
378389 }
379390 mainDtsRollupPath = path . relative ( dtsRollup . publishFolder ! , resolvedTypings ) ;
380391 }
@@ -386,44 +397,35 @@ export class Extractor {
386397
387398 if ( ! path . isAbsolute ( mainDtsRollupPath ) ) {
388399 this . _monitoredLogger . logError ( 'The "mainDtsRollupPath" setting must be a relative path'
389- + ' that can be combined with "publishFolderForInternal", "publishFolderForBeta", '
390- + 'or "publishFolderForPublic".' ) ;
391- return false ;
400+ + ' that can be combined with one of the "publishFolder" settings.' ) ;
401+ return ;
392402 }
393403 }
394404
395405 const dtsRollupGenerator : DtsRollupGenerator = new DtsRollupGenerator ( context ) ;
396406 dtsRollupGenerator . analyze ( ) ;
397407
398408 if ( dtsRollup . trimming ) {
399- this . _generateTypingsFile ( dtsRollupGenerator ,
409+ this . _generateRollupDtsFile ( dtsRollupGenerator ,
400410 path . resolve ( context . packageFolder , dtsRollup . publishFolderForPublic ! , mainDtsRollupPath ) ,
401411 DtsRollupKind . PublicRelease ) ;
402412
403- this . _generateTypingsFile ( dtsRollupGenerator ,
413+ this . _generateRollupDtsFile ( dtsRollupGenerator ,
404414 path . resolve ( context . packageFolder , dtsRollup . publishFolderForBeta ! , mainDtsRollupPath ) ,
405415 DtsRollupKind . BetaRelease ) ;
406416
407- this . _generateTypingsFile ( dtsRollupGenerator ,
417+ this . _generateRollupDtsFile ( dtsRollupGenerator ,
408418 path . resolve ( context . packageFolder , dtsRollup . publishFolderForInternal ! , mainDtsRollupPath ) ,
409419 DtsRollupKind . InternalRelease ) ;
410420 } else {
411- this . _generateTypingsFile ( dtsRollupGenerator ,
421+ this . _generateRollupDtsFile ( dtsRollupGenerator ,
412422 path . resolve ( context . packageFolder , dtsRollup . publishFolder ! , mainDtsRollupPath ) ,
413423 DtsRollupKind . InternalRelease ) ; // (no trimming)
414424 }
415425 }
416-
417- if ( this . _localBuild ) {
418- // For a local build, fail if there were errors (but ignore warnings)
419- return this . _monitoredLogger . errorCount === 0 ;
420- } else {
421- // For a production build, fail if there were any errors or warnings
422- return ( this . _monitoredLogger . errorCount + this . _monitoredLogger . warningCount ) === 0 ;
423- }
424426 }
425427
426- private _generateTypingsFile ( dtsRollupGenerator : DtsRollupGenerator , mainDtsRollupFullPath : string ,
428+ private _generateRollupDtsFile ( dtsRollupGenerator : DtsRollupGenerator , mainDtsRollupFullPath : string ,
427429 dtsKind : DtsRollupKind ) : void {
428430
429431 this . _monitoredLogger . logVerbose ( `Writing package typings: ${ mainDtsRollupFullPath } ` ) ;
0 commit comments