@@ -41,17 +41,17 @@ function guessPathIfEmpty(publicPath) {
4141
4242 if ( _ . isEmpty ( publicPath ) ) {
4343 spinner . info (
44- `🤔 No ${ white ( 'path' ) } argument specified. Looking for common ones…`
44+ `🤔 No ${ white ( 'path' ) } argument specified. Looking for common ones…`
4545 )
4646 result = guessedPath ( )
4747 if ( result ) {
4848 spinner . succeed (
49- `📂 Found local ${ chalk . blue ( result ) } directory. Deploying that.`
49+ `📂 Found local ${ chalk . blue ( result ) } directory. Deploying that.`
5050 )
5151 return result
5252 } else {
5353 spinner . fail (
54- `🔮 Couldn't guess what to deploy. Please specify a ${ white ( 'path' ) } .`
54+ `🔮 Couldn't guess what to deploy. Please specify a ${ white ( 'path' ) } .`
5555 )
5656 return undefined
5757 }
@@ -62,18 +62,18 @@ function guessPathIfEmpty(publicPath) {
6262
6363async function openUrl ( url ) {
6464 const spinner = ora ( )
65- spinner . start ( '🏄 Opening web browser…' )
65+ spinner . start ( '🏄 Opening web browser…' )
6666 const childProcess = await doOpen ( url )
67- spinner . succeed ( '🏄 Opened web browser (call with -O to disable.)' )
67+ spinner . succeed ( '🏄 Opened web browser (call with -O to disable.)' )
6868 return childProcess
6969}
7070
7171async function updateCloudflareDns ( siteDomain , { apiEmail, apiKey } , hash ) {
7272 const spinner = ora ( )
7373
74- spinner . start ( `📡 Beaming new hash to DNS provider ${ white ( 'Cloudflare' ) } …` )
74+ spinner . start ( `📡 Beaming new hash to DNS provider ${ white ( 'Cloudflare' ) } …` )
7575 if ( fp . some ( _ . isEmpty ) ( [ siteDomain , apiEmail , apiKey ] ) ) {
76- spinner . fail ( '💔 Missing arguments for Cloudflare API.' )
76+ spinner . fail ( '💔 Missing arguments for Cloudflare API.' )
7777 spinner . warn ( '🧐 Check if these environment variables are present:' )
7878 logError ( `
7979 IPFS_DEPLOY_SITE_DOMAIN
@@ -96,11 +96,11 @@ async function updateCloudflareDns(siteDomain, { apiEmail, apiKey }, hash) {
9696 }
9797
9898 const content = await updateCloudflareDnslink ( api , opts )
99- spinner . succeed ( '🙌 SUCCESS!' )
100- spinner . info ( `🔄 Updated DNS TXT ${ white ( opts . record ) } to:` )
101- spinner . info ( `🔗 ${ white ( content ) } ` )
99+ spinner . succeed ( '🙌 SUCCESS!' )
100+ spinner . info ( `🔄 Updated DNS TXT ${ white ( opts . record ) } to:` )
101+ spinner . info ( `🔗 ${ white ( content ) } ` )
102102 } catch ( e ) {
103- spinner . fail ( "💔 Updating Cloudflare DNS didn't work." )
103+ spinner . fail ( "💔 Updating Cloudflare DNS didn't work." )
104104 logError ( e )
105105 }
106106
@@ -110,15 +110,15 @@ async function updateCloudflareDns(siteDomain, { apiEmail, apiKey }, hash) {
110110
111111async function showSize ( path ) {
112112 const spinner = ora ( )
113- spinner . start ( `📦 Calculating size of ${ chalk . blue ( path ) } …` )
113+ spinner . start ( `📦 Calculating size of ${ chalk . blue ( path ) } …` )
114114 try {
115115 const size = await trammel ( path , {
116116 stopOnError : true ,
117117 type : 'raw' ,
118118 } )
119119 const kibi = byteSize ( size , { units : 'iec' } )
120120 const readableSize = `${ kibi . value } ${ kibi . unit } `
121- spinner . succeed ( `🚚 ${ chalk . blue ( path ) } weighs ${ readableSize } .` )
121+ spinner . succeed ( `🚚 ${ chalk . blue ( path ) } weighs ${ readableSize } .` )
122122 return readableSize
123123 } catch ( e ) {
124124 spinner . fail ( "⚖ Couldn't calculate website size." )
@@ -138,28 +138,35 @@ async function addToInfura(publicDirPath) {
138138
139139 try {
140140 spinner . start (
141- `📠 Uploading and pinning via https to ${ white ( 'infura.io' ) } …`
141+ `📠 Uploading and pinning via https to ${ white ( 'infura.io' ) } …`
142142 )
143143 const response = await infuraClient . addFromFs ( publicDirPath , {
144144 recursive : true ,
145145 } )
146- spinner . succeed ( "📌 It's pinned to Infura now with hash:" )
146+ spinner . succeed ( "📌 It's pinned to Infura now with hash:" )
147147 const hash = response [ response . length - 1 ] . hash
148- spinner . info ( `🔗 ${ hash } ` )
148+ spinner . info ( `🔗 ${ hash } ` )
149149 return hash
150150 } catch ( e ) {
151- spinner . fail ( "💔 Uploading to Infura didn't work." )
151+ spinner . fail ( "💔 Uploading to Infura didn't work." )
152152 logError ( e )
153153 return undefined
154154 }
155155}
156156
157157function copyUrlToClipboard ( url ) {
158158 const spinner = ora ( )
159- spinner . start ( '📋 Copying HTTP gateway URL to clipboard…' )
160- clipboardy . writeSync ( url )
161- spinner . succeed ( '📋 Copied HTTP gateway URL to clipboard:' )
162- spinner . info ( `🔗 ${ chalk . green ( url ) } ` )
159+ spinner . start ( '📋 Copying HTTP gateway URL to clipboard…' )
160+ try {
161+ clipboardy . writeSync ( url )
162+ spinner . succeed ( '📋 Copied HTTP gateway URL to clipboard:' )
163+ spinner . info ( `🔗 ${ chalk . green ( url ) } ` )
164+ return url
165+ } catch ( e ) {
166+ spinner . fail ( '⚠️ Could not copy URL to clipboard.' )
167+ logError ( e )
168+ return undefined
169+ }
163170}
164171
165172async function deploy ( {
0 commit comments