🎥 Make videos programmatically with React
show progress for evaluating composition
Jonny Burgerb35987c035da
diff --git a/packages/cli/src/progress-bar.ts b/packages/cli/src/progress-bar.tsindex e7acd8110c..443f470268 100644--- a/packages/cli/src/progress-bar.ts+++ b/packages/cli/src/progress-bar.ts@@ -21,7 +21,7 @@ export type OverwriteableCliOutput = {update: (up: string, newline: boolean) => boolean;};-export const LABEL_WIDTH = 18;+export const LABEL_WIDTH = 20;export const createOverwriteableCliOutput = (options: {quiet: boolean;diff --git a/packages/lambda/src/cli/commands/render/progress.ts b/packages/lambda/src/cli/commands/render/progress.tsindex faaa08c364..6de035a1e8 100644--- a/packages/lambda/src/cli/commands/render/progress.ts+++ b/packages/lambda/src/cli/commands/render/progress.ts@@ -9,6 +9,34 @@ type LambdaInvokeProgress = {lambdasInvoked: number;};+const makeEvaluationProgress = (overall: RenderProgress) => {+ const timeToLaunch = overall.compositionValidated+ ? overall.compositionValidated - overall.functionLaunched+ : null;++ if (timeToLaunch) {+ return [+ `Got composition`.padEnd(CliInternals.LABEL_WIDTH),+ CliInternals.makeProgressBar(1),+ CliInternals.chalk.gray(`${timeToLaunch}ms`),+ ].join(' ');+ }++ if (overall.serveUrlOpened) {+ return [+ `Calculating metadata`.padEnd(CliInternals.LABEL_WIDTH),+ CliInternals.makeProgressBar(0.5),+ `${overall.currentTime - overall.serveUrlOpened}ms`,+ ].join(' ');+ }++ return [+ `Visiting Site`.padEnd(CliInternals.LABEL_WIDTH),+ CliInternals.makeProgressBar(0),+ `${overall.currentTime - overall.functionLaunched}ms`,+ ].join(' ');+};+const makeInvokeProgress = (overall: RenderProgress) => {const invokeProgress: LambdaInvokeProgress = {lambdasInvoked: overall.lambdasInvoked,@@ -184,6 +212,7 @@ export const makeProgressString = ({}) => {return [makeTopRow(overall),+ makeEvaluationProgress(overall),...makeInvokeProgress(overall),...makeRenderProgress(overall),makeCombinationProgress(overall),diff --git a/packages/lambda/src/functions/helpers/get-progress.ts b/packages/lambda/src/functions/helpers/get-progress.tsindex dd1e56ee55..b466e4af6f 100644--- a/packages/lambda/src/functions/helpers/get-progress.ts+++ b/packages/lambda/src/functions/helpers/get-progress.ts@@ -107,6 +107,9 @@ export const getProgress = async ({combinedFrames: totalFrameCount,renderMetadata: overallProgress.renderMetadata,timeoutTimestamp: overallProgress.timeoutTimestamp,+ compositionValidated: overallProgress.compositionValidated,+ functionLaunched: overallProgress.functionLaunched,+ serveUrlOpened: overallProgress.serveUrlOpened,};}@@ -248,5 +251,8 @@ export const getProgress = async ({timeToCombine: overallProgress.timeToCombine ?? null,timeoutTimestamp: overallProgress.timeoutTimestamp,type: 'success',+ compositionValidated: overallProgress.compositionValidated,+ functionLaunched: overallProgress.functionLaunched,+ serveUrlOpened: overallProgress.serveUrlOpened,};};diff --git a/packages/lambda/src/functions/helpers/overall-render-progress.ts b/packages/lambda/src/functions/helpers/overall-render-progress.tsindex 1d8ea18915..ecc6557e89 100644--- a/packages/lambda/src/functions/helpers/overall-render-progress.ts+++ b/packages/lambda/src/functions/helpers/overall-render-progress.ts@@ -61,7 +61,6 @@ export const makeInitialOverallRenderProgress = (timeoutTimestamp: number,): OverallRenderProgress => {return {- functionLaunched: Date.now(),chunks: [],framesRendered: 0,framesEncoded: 0,@@ -76,6 +75,7 @@ export const makeInitialOverallRenderProgress = (errors: [],timeToRenderFrames: null,timeoutTimestamp,+ functionLaunched: Date.now(),serveUrlOpened: null,compositionValidated: null,};diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.tsindex 6d59235d91..8abd7bd221 100644--- a/packages/lambda/src/shared/constants.ts+++ b/packages/lambda/src/shared/constants.ts@@ -464,6 +464,9 @@ export type RenderProgress = {combinedFrames: number;timeToCombine: number | null;timeoutTimestamp: number;+ functionLaunched: number;+ serveUrlOpened: number | null;+ compositionValidated: number | null;};export type Privacy = 'public' | 'private' | 'no-acl';