diff --git a/lib/index.js b/lib/index.js index cb87d76..7b086ee 100644 --- a/lib/index.js +++ b/lib/index.js @@ -46,6 +46,7 @@ module.exports = function( args, options ) { const processedPackages = new Set(); const commandResponses = new Set(); + const packagesWithError = new Set(); const packageNames = getPackageNames( options ); let allPackagesNumber = packageNames.length; @@ -97,6 +98,10 @@ module.exports = function( args, options ) { } if ( returnedData.logs ) { + if ( returnedData.logs.error.length ) { + packagesWithError.add( packageName ); + } + logDisplay( packageName, returnedData.logs, { current: donePackagesNumber, all: allPackagesNumber, @@ -125,6 +130,14 @@ module.exports = function( args, options ) { const endTime = process.hrtime( startTime ); console.log( chalk.cyan( `Execution time: ${ endTime[ 0 ] }s${ endTime[ 1 ].toString().substring( 0, 3 ) }ms.` ) ); + + if ( packagesWithError.size ) { + const repositoryForm = packagesWithError.size === 1 ? 'repository' : 'repositories'; + const message = `\nā—ā—ā— The command failed to execute in ${ packagesWithError.size } ${ repositoryForm }.\n`; + + console.log( chalk.red( message ) ); + process.exit( 1 ); + } } ); } }; diff --git a/lib/utils/displaylog.js b/lib/utils/displaylog.js index b050d85..be3c82d 100644 --- a/lib/utils/displaylog.js +++ b/lib/utils/displaylog.js @@ -38,8 +38,6 @@ module.exports = function displayLog( packageName, logs, options ) { } if ( errorLogs ) { - process.exitCode = 1; - console.log( chalk.red( errorLogs ) ); }