Skip to content

Commit 707b122

Browse files
committed
refactor: add progress messages
1 parent 624dd09 commit 707b122

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

src/commands/deploy/deploy.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ const deployProgressCb = function () {
275275
}
276276
return
277277
}
278+
case 'error':
279+
stopSpinner({ error: true, spinner: events[event.type], text: event.msg })
280+
delete events[event.type]
281+
return
278282
case 'stop':
279283
default: {
280284
stopSpinner({ spinner: events[event.type], text: event.msg })
@@ -389,15 +393,31 @@ const handleBuild = async ({ cachedConfig, options }) => {
389393
*/
390394
const bundleEdgeFunctions = async (options) => {
391395
const { runCoreSteps } = await runCoreStepPromise
392-
const { logs, severityCode, success } = await runCoreSteps(
393-
['edge_functions_bundling'],
394-
Object.assign(options, { buffer: true }),
395-
)
396+
const statusCb = options.silent ? () => {} : deployProgressCb()
397+
398+
statusCb({
399+
type: 'edge-functions-bundling',
400+
msg: 'Bundling edge functions...\n',
401+
phase: 'start',
402+
})
403+
404+
const { severityCode, success } = await runCoreSteps(['edge_functions_bundling'], { ...options, buffer: true })
396405

397406
if (!success) {
398-
log([logs.stdout.join('\n'), logs.stderr.join('\n')].filter(Boolean).join('\n\n'))
407+
statusCb({
408+
type: 'edge-functions-bundling',
409+
msg: 'Deploy aborted due to error while bundling edge functions',
410+
phase: 'error',
411+
})
412+
399413
exit(severityCode)
400414
}
415+
416+
statusCb({
417+
type: 'edge-functions-bundling',
418+
msg: 'Finished bundling edge functions',
419+
phase: 'stop',
420+
})
401421
}
402422

403423
/**

0 commit comments

Comments
 (0)