@@ -17,24 +17,20 @@ const formatServices = require('../util/formatServices');
17
17
18
18
const defaultIgnores = [ '.git' , 'node_modules' , '.exoframeignore' ] ;
19
19
20
- const streamToResponse = ( { tarStream, remoteUrl, options, verbose, handleUpload , handleDownload } ) =>
20
+ const streamToResponse = ( { tarStream, remoteUrl, options, verbose, spinner } ) =>
21
21
new Promise ( ( resolve , reject ) => {
22
22
// store error and result
23
23
let error ;
24
24
let result = { } ;
25
25
// pipe stream to remote
26
- const stream = _ (
27
- tarStream . pipe (
28
- got . stream
29
- . post ( remoteUrl , options )
30
- . on ( 'uploadProgress' , handleUpload )
31
- . on ( 'downloadProgress' , handleDownload )
32
- )
33
- )
26
+ const stream = _ ( tarStream . pipe ( got . stream . post ( remoteUrl , options ) ) )
34
27
. split ( )
35
28
. filter ( l => l && l . length ) ;
36
29
// store output
37
30
stream . on ( 'data' , str => {
31
+ if ( spinner ) {
32
+ spinner . text = 'Project uploaded! Waiting for deployment..' ;
33
+ }
38
34
const s = str . toString ( ) ;
39
35
try {
40
36
const data = JSON . parse ( s ) ;
@@ -195,13 +191,10 @@ exports.handler = async (args = {}) => {
195
191
196
192
// pipe stream to remote
197
193
try {
198
- const handleUpload = ( ) => {
194
+ if ( spinner ) {
199
195
spinner . text = `Uploading project..` ;
200
- } ;
201
- const handleDownload = ( ) => {
202
- spinner . text = 'Project uploaded! Waiting for deployment..' ;
203
- } ;
204
- const res = await streamToResponse ( { tarStream, remoteUrl, options, verbose, handleUpload, handleDownload} ) ;
196
+ }
197
+ const res = await streamToResponse ( { tarStream, remoteUrl, options, verbose, spinner} ) ;
205
198
// check deployments
206
199
if ( ! res . deployments || ! res . deployments . length ) {
207
200
const err = new Error ( 'Something went wrong!' ) ;
0 commit comments