Skip to content

🎥 Make videos programmatically with React

npx remotion compositions -q

Jonny Burgerb190d6a6e24b
diff --git a/packages/cli/src/compositions.ts b/packages/cli/src/compositions.ts
index c69c9f0656..13dca8c4a7 100644
--- a/packages/cli/src/compositions.ts
+++ b/packages/cli/src/compositions.ts
@@ -3,7 +3,7 @@ import path from 'path';
import {getCliOptions} from './get-cli-options';
import {loadConfig} from './get-config-file-name';
import {Log} from './log';
-import {parsedCli} from './parse-command-line';
+import {parsedCli, quietFlagProvided} from './parse-command-line';
import {bundleOnCli} from './setup-cache';
const max = (arr: number[]) => {
@@ -51,7 +51,7 @@ export const listCompositionsCommand = async () => {
port,
} = await getCliOptions({isLambda: false, type: 'get-compositions'});
- const bundled = await bundleOnCli(fullPath, ['bundling']);
+ const bundled = await bundleOnCli({fullPath, steps: ['bundling']});
const compositions = await getCompositions(bundled, {
browserExecutable,
@@ -63,14 +63,24 @@ export const listCompositionsCommand = async () => {
timeoutInMilliseconds: puppeteerTimeout,
port,
});
- Log.info();
- Log.info('The following compositions are available:');
- Log.info();
+ if (!quietFlagProvided()) {
+ Log.info();
+ Log.info('The following compositions are available:');
+ Log.info();
+ }
const firstColumnLength = max(compositions.map(({id}) => id.length)) + 4;
const secondColumnLength = 8;
const thirdColumnLength = 15;
+ if (quietFlagProvided()) {
+ for (const composition of compositions) {
+ Log.info(composition.id);
+ }
+
+ return;
+ }
+
Log.info(
`${'Composition'.padEnd(firstColumnLength, ' ')}${'FPS'.padEnd(
secondColumnLength
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index bac091b136..9be092252b 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -97,7 +97,7 @@ export const render = async () => {
const urlOrBundle = RenderInternals.isServeUrl(fullPath)
? fullPath
- : await bundleOnCli(fullPath, steps);
+ : await bundleOnCli({fullPath, steps});
const onDownload: RenderMediaOnDownload = (src) => {
const id = Math.random();
diff --git a/packages/cli/src/setup-cache.ts b/packages/cli/src/setup-cache.ts
index 8ca2725f82..6a3a3c201a 100644
--- a/packages/cli/src/setup-cache.ts
+++ b/packages/cli/src/setup-cache.ts
@@ -8,7 +8,13 @@ import {
} from './progress-bar';
import type {RenderStep} from './step';
-export const bundleOnCli = async (fullPath: string, steps: RenderStep[]) => {
+export const bundleOnCli = async ({
+ fullPath,
+ steps,
+}: {
+ fullPath: string;
+ steps: RenderStep[];
+}) => {
const shouldCache = Internals.getWebpackCaching();
const cacheExistedBefore = BundlerInternals.cacheExists('production');
if (cacheExistedBefore && !shouldCache) {
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index a847c8b8f0..9d60f65c3d 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -112,7 +112,7 @@ export const still = async () => {
const urlOrBundle = RenderInternals.isServeUrl(fullPath)
? Promise.resolve(fullPath)
- : await bundleOnCli(fullPath, steps);
+ : await bundleOnCli({fullPath, steps});
const puppeteerInstance = await browserInstance;
const comps = await getCompositions(await urlOrBundle, {
diff --git a/packages/docs/docs/cli/compositions.md b/packages/docs/docs/cli/compositions.md
index 601bb3293a..d9032df8dd 100644
--- a/packages/docs/docs/cli/compositions.md
+++ b/packages/docs/docs/cli/compositions.md
@@ -72,3 +72,7 @@ This will most notably disable CORS in Chrome among other security features.
### `--disable-headless`
Opens an actual browser to observe the composition fetching.
+
+### `--quiet`, `--q`
+
+Only prints the composition ID, one per line, and nothing else.