🎥 Make videos programmatically with React
`@remotion/cli`: Migrate more options to option system (#8942)
Jonny Burger6d04541a544d
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.tsindex 87721c2a69..87a896de90 100644--- a/packages/cli/src/parse-command-line.ts+++ b/packages/cli/src/parse-command-line.ts@@ -1,6 +1,9 @@+import {BrowserSafeApis} from '@remotion/renderer/client';import {Config} from './config';import {parsedCli} from './parsed-cli';+const {licenseKeyOption} = BrowserSafeApis.options;+export const parseCommandLine = () => {if (parsedCli.png) {throw new Error(@@ -8,10 +11,10 @@ export const parseCommandLine = () => {);}- if (- parsedCli['license-key'] &&- parsedCli['license-key'].startsWith('rm_pub_')- ) {- Config.setPublicLicenseKey(parsedCli['license-key']);+ const {value: licenseKey, source} = licenseKeyOption.getValue({+ commandLine: parsedCli,+ });+ if (source === 'cli' && licenseKey?.startsWith('rm_pub_')) {+ Config.setPublicLicenseKey(licenseKey);}};diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsxindex 7d143c492c..c7beebbb82 100644--- a/packages/cli/src/render.tsx+++ b/packages/cli/src/render.tsx@@ -62,6 +62,7 @@ const {overrideDurationOption,bundleCacheOption,sampleRateOption,+ stillFrameOption,} = BrowserSafeApis.options;export const render = async (@@ -93,7 +94,7 @@ export const render = async (const fullEntryPoint = convertEntryPointToServeUrl(file);- if (parsedCli.frame) {+ if (stillFrameOption.getValue({commandLine: parsedCli}).source === 'cli') {Log.error({indent: false, logLevel},'--frame flag was passed to the `render` command. This flag only works with the `still` command. Did you mean `--frames`? See reference: https://www.remotion.dev/docs/cli/',diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.tsindex 2d6390a8db..b1811ea2d5 100644--- a/packages/cli/src/still.ts+++ b/packages/cli/src/still.ts@@ -40,6 +40,7 @@ const {overrideFpsOption,overrideDurationOption,bundleCacheOption,+ framesOption,} = BrowserSafeApis.options;export const still = async (@@ -71,7 +72,7 @@ export const still = async (const fullEntryPoint = convertEntryPointToServeUrl(file);- if (parsedCli.frames) {+ if (framesOption.getValue({commandLine: parsedCli}).source === 'cli') {Log.error({indent: false, logLevel},'--frames flag was passed to the `still` command. This flag only works with the `render` command. Did you mean `--frame`? See reference: https://www.remotion.dev/docs/cli/',diff --git a/packages/cloudrun/src/cli/commands/render/index.ts b/packages/cloudrun/src/cli/commands/render/index.tsindex d59564c7c1..1a4983c319 100644--- a/packages/cloudrun/src/cli/commands/render/index.ts+++ b/packages/cloudrun/src/cli/commands/render/index.ts@@ -51,6 +51,7 @@ const {overrideFpsOption,overrideDurationOption,sampleRateOption,+ concurrencyOption,} = BrowserSafeApis.options;export const renderCommand = async (@@ -108,6 +109,9 @@ export const renderCommand = async (const durationInFrames = overrideDurationOption.getValue({commandLine: CliInternals.parsedCli,}).value;+ const concurrency = concurrencyOption.getValue({+ commandLine: CliInternals.parsedCli,+ });const pixelFormat = pixelFormatOption.getValue({commandLine: CliInternals.parsedCli,@@ -385,7 +389,7 @@ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}delayRenderTimeoutInMilliseconds: puppeteerTimeout,// Special case: Should not use default local concurrency, or from// config file, just when explicitly set- concurrency: CliInternals.parsedCli.concurrency ?? null,+ concurrency: concurrency.source === 'cli' ? concurrency.value : null,enforceAudioTrack,preferLossless: false,offthreadVideoCacheSizeInBytes,