🎥 Make videos programmatically with React
unifying 2nd and 3rd parameters of getCompositions
Felippe Chemello6671d99f8dd4
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsxindex 7216984636..ec4336390f 100644--- a/packages/cli/src/render.tsx+++ b/packages/cli/src/render.tsx@@ -162,11 +162,10 @@ export const render = async () => {if (cacheExistedAfter && !cacheExistedBefore) {console.log('⚡️ Cached bundle. Subsequent builds will be faster.');}- const comps = await getCompositions(- bundled,- Internals.getBrowser() ?? Internals.DEFAULT_BROWSER,- userProps- );+ const comps = await getCompositions(bundled, {+ browser: Internals.getBrowser() || Internals.DEFAULT_BROWSER,+ userProps,+ });const compositionId = getCompositionId(comps);const config = comps.find((c) => c.id === compositionId);diff --git a/packages/renderer/src/get-compositions.ts b/packages/renderer/src/get-compositions.tsindex 2559b5c6d3..7b871d6578 100644--- a/packages/renderer/src/get-compositions.ts+++ b/packages/renderer/src/get-compositions.ts@@ -4,17 +4,18 @@ import {serveStatic} from './serve-static';export const getCompositions = async (webpackBundle: string,- browser: Browser = Internals.DEFAULT_BROWSER,- userProps: unknown+ config?: {browser?: Browser; userProps?: unknown}): Promise<TCompMetadata[]> => {- const browserInstance = await openBrowser(browser);+ const browserInstance = await openBrowser(+ config?.browser || Internals.DEFAULT_BROWSER+ );const page = await browserInstance.newPage();const {port, close} = await serveStatic(webpackBundle);await page.goto(`http://localhost:${port}/index.html?evaluation=true&props=${encodeURIComponent(- JSON.stringify(userProps)+ JSON.stringify(config?.userProps || {}))}`);await page.waitForFunction('window.ready === true');