import { EventEmitter } from 'events' ; import { log } from './FsOps' ; import Conversion from './Conversion' ; /**
 * Generates a summary report.
 */ export default ( conversion ) : void => { if ( conversion . _runsInTestMode ) { ( < EventEmitter > conversion . _eventEmitter ) . emit ( conversion . _migrationCompletedEvent ) ; return ; } let differenceSec = ( ( new Date ( ) ) . getTime ( ) - ( < Date > conversion . _timeBegin ) . getTime ( ) ) / 1000 ; const seconds = Math . floor ( differenceSec % 60 ) ; differenceSec = differenceSec / 60 ; const minutes = Math . floor ( differenceSec % 60 ) ; const hours = Math . floor ( differenceSec / 60 ) ; const formattedHours = hours < 10 ? `0${ hours }` : `${ hours }` ; const formattedMinutes = minutes < 10 ? `0${ minutes }` : `${ minutes }` ; const formattedSeconds = seconds < 10 ? `0${ seconds }` : `${ seconds }` ; const endMsg = 'NMIG migration is accomplished.' ; const output = `\t--[generateReport] ${ endMsg }
        \n\t--[generateReport] Total time: ${ formattedHours }:${ formattedMinutes }:${ formattedSeconds }
        \n\t--[generateReport] (hours:minutes:seconds)` ; log ( conversion , output , undefined , ( ) => process . exit ( 0 ) ) ; } ;