@@ -100,8 +100,10 @@ function guessPathIfEmpty(publicPath) {
100100 spinner . fail (
101101 `🔮 Couldn't guess what to deploy. Please specify a ${ white ( 'path' ) } .`
102102 )
103- process . exit ( 1 )
103+ return undefined
104104 }
105+ } else {
106+ return publicPath
105107 }
106108}
107109
@@ -164,10 +166,11 @@ async function showSize(path) {
164166 const kibi = byteSize ( size , { units : 'iec' } )
165167 const readableSize = `${ kibi . value } ${ kibi . unit } `
166168 spinner . succeed ( `🚚 ${ chalk . blue ( path ) } weighs ${ readableSize } .` )
169+ return readableSize
167170 } catch ( e ) {
168171 spinner . fail ( "⚖ Couldn't calculate website size." )
169172 logError ( e )
170- process . exit ( 1 )
173+ return undefined
171174 }
172175}
173176
@@ -326,7 +329,15 @@ async function deploy({
326329} = { } ) {
327330 publicDirPath = guessPathIfEmpty ( publicDirPath )
328331
329- await showSize ( publicDirPath )
332+ if ( ! publicDirPath ) {
333+ return undefined
334+ }
335+
336+ const readableSize = await showSize ( publicDirPath )
337+
338+ if ( ! readableSize ) {
339+ return undefined
340+ }
330341
331342 let successfulRemotePinners = [ ]
332343 let pinnedHashes = { }
@@ -374,13 +385,16 @@ async function deploy({
374385 await updateCloudflareDns ( siteDomain , credentials . cloudflare , pinnedHash )
375386 }
376387
377- if ( open && _ . isEmpty ( dnsProviders ) )
388+ if ( open && _ . isEmpty ( dnsProviders ) ) {
378389 await openUrl ( publicGatewayUrl ( pinnedHash ) )
379- if ( open && ! _ . isEmpty ( dnsProviders ) )
390+ }
391+ if ( open && ! _ . isEmpty ( dnsProviders ) ) {
380392 await openUrl ( `https://${ siteDomain } ` )
393+ }
394+ return pinnedHash
381395 } else {
382396 logError ( 'Failed to deploy.' )
383- process . exit ( 1 )
397+ return undefined
384398 }
385399}
386400
0 commit comments