Skip to content

πŸŽ₯ Make videos programmatically with React

cool indentation

Jonny Burger348ceee0b794
diff --git a/packages/cli/src/log.ts b/packages/cli/src/log.ts
index c457ef5809..6ed79bb9b8 100644
--- a/packages/cli/src/log.ts
+++ b/packages/cli/src/log.ts
@@ -4,7 +4,7 @@ import {chalk} from './chalk';
import {ConfigInternals} from './config';
import {truthy} from './truthy';
-export const INDENT_TOKEN = '|';
+export const INDENT_TOKEN = 'β”‚';
export const Log = {
verbose: (...args: Parameters<typeof console.log>) => {
@@ -28,7 +28,9 @@ export const Log = {
}
},
infoIndent: (indent: boolean, ...args: Parameters<typeof console.log>) => {
- Log.info(...[indent ? INDENT_TOKEN : null, ...args].filter(truthy));
+ Log.info(
+ ...[indent ? chalk.gray(INDENT_TOKEN) : null, ...args].filter(truthy)
+ );
},
warn: (...args: Parameters<typeof console.log>) => {
if (
diff --git a/packages/cli/src/preview-server/render-queue/process-still.ts b/packages/cli/src/preview-server/render-queue/process-still.ts
index f1be156aea..5f69da7bc1 100644
--- a/packages/cli/src/preview-server/render-queue/process-still.ts
+++ b/packages/cli/src/preview-server/render-queue/process-still.ts
@@ -1,5 +1,7 @@
+import {chalk} from '../../chalk';
import {convertEntryPointToServeUrl} from '../../convert-entry-point-to-serve-url';
import {getCliOptions} from '../../get-cli-options';
+import {Log} from '../../log';
import {renderStillFlow} from '../../render-flows/still';
import type {JobProgressCallback, RenderJob} from './job';
@@ -39,6 +41,8 @@ export const processStill = async ({
const fullEntryPoint = convertEntryPointToServeUrl(entryPoint);
+ Log.info(chalk.gray('╭─ Rendering still ' + job.compositionId));
+ const startTime = Date.now();
await renderStillFlow({
remotionRoot,
browser,
@@ -67,6 +71,7 @@ export const processStill = async ({
onProgress,
indentOutput: true,
});
+ Log.info(chalk.gray('╰─ Done in ' + (Date.now() - startTime) + 'ms.'));
// TODO: Allow cancel signal
// TODO: Accept CLI options
};
diff --git a/packages/cli/src/progress-bar.ts b/packages/cli/src/progress-bar.ts
index fa0826a724..00141b881b 100644
--- a/packages/cli/src/progress-bar.ts
+++ b/packages/cli/src/progress-bar.ts
@@ -48,7 +48,7 @@ export const createOverwriteableCliOutput = (options: {
return {
update: (up: string): boolean =>
process.stdout.write(
- diff.update((options.indent ? INDENT_TOKEN + ' ' : '') + up)
+ diff.update((options.indent ? chalk.gray(INDENT_TOKEN) + ' ' : '') + up)
),
};
};
diff --git a/packages/cli/src/render-flows/still.ts b/packages/cli/src/render-flows/still.ts
index 9eb0b63ef1..a1eb28e0b9 100644
--- a/packages/cli/src/render-flows/still.ts
+++ b/packages/cli/src/render-flows/still.ts
@@ -97,7 +97,6 @@ export const renderStillFlow = async ({
onProgress: JobProgressCallback;
indentOutput: boolean;
}) => {
- const startTime = Date.now();
const downloads: DownloadProgress[] = [];
const aggregate: AggregateRenderProgress = {
@@ -277,19 +276,6 @@ export const renderStillFlow = async ({
const closeBrowserPromise = puppeteerInstance.close(false);
- Log.infoIndent(indentOutput);
- Log.infoIndent(indentOutput, chalk.green('Your still frame is ready!'));
-
- const seconds = Math.round((Date.now() - startTime) / 1000);
- Log.infoIndent(
- indentOutput,
- [
- '- Total render time:',
- seconds,
- seconds === 1 ? 'second' : 'seconds',
- ].join(' ')
- );
- Log.infoIndent(indentOutput, '-', 'Output can be found at:');
Log.infoIndent(indentOutput, chalk.cyan(`▢️ ${absoluteOutputLocation}`));
await closeBrowserPromise;
await RenderInternals.cleanDownloadMap(downloadMap);