🎥 Make videos programmatically with React
Complete CLI help options and trim tests
JonnyBurger95576f2c8142
diff --git a/packages/cli/src/cloudrun-command.ts b/packages/cli/src/cloudrun-command.tsindex 4f3979ffc2..9043747fe1 100644--- a/packages/cli/src/cloudrun-command.ts+++ b/packages/cli/src/cloudrun-command.ts@@ -16,15 +16,17 @@ export const tryPrintCloudrunHelp = (return false;}- const {printHelp} = require(path);- if (typeof printHelp !== 'function') {- throw new TypeError(- '@remotion/cloudrun/internal/help does not export printHelp',- );- }+ try {+ const {printHelp} = require(path);+ if (typeof printHelp !== 'function') {+ return false;+ }- printHelp(args, logLevel);- return true;+ printHelp(args, logLevel);+ return true;+ } catch {+ return false;+ }};export const cloudrunCommand = async (diff --git a/packages/cli/src/lambda-command.ts b/packages/cli/src/lambda-command.tsindex a4f85b17ad..bffcb1e55b 100644--- a/packages/cli/src/lambda-command.ts+++ b/packages/cli/src/lambda-command.ts@@ -16,15 +16,17 @@ export const tryPrintLambdaHelp = (return false;}- const {printHelp} = require(path);- if (typeof printHelp !== 'function') {- throw new TypeError(- '@remotion/lambda/internal/help does not export printHelp',- );- }+ try {+ const {printHelp} = require(path);+ if (typeof printHelp !== 'function') {+ return false;+ }- printHelp(args, logLevel);- return true;+ printHelp(args, logLevel);+ return true;+ } catch {+ return false;+ }};export const lambdaCommand = async (diff --git a/packages/cli/src/print-help.ts b/packages/cli/src/print-help.tsindex efd51ad500..2f11749d4a 100644--- a/packages/cli/src/print-help.ts+++ b/packages/cli/src/print-help.ts@@ -74,6 +74,43 @@ const studioOptions = options(['no-open','browser','browser-args',+ 'browser-executable',+ 'bundle-cache',+ 'chrome-mode',+ 'concurrency',+ 'image-format',+ 'jpeg-quality',+ 'pixel-format',+ 'scale',+ 'crf',+ 'prores-profile',+ 'x264-preset',+ 'gop',+ 'audio-bitrate',+ 'video-bitrate',+ 'audio-codec',+ 'buffer-size',+ 'max-rate',+ 'every-nth-frame',+ 'muted',+ 'enforce-audio-track',+ 'number-of-gif-loops',+ 'color-space',+ 'hardware-acceleration',+ 'timeout',+ 'ignore-certificate-errors',+ 'disable-web-security',+ 'disable-headless',+ 'dark-mode',+ 'gl',+ 'user-agent',+ 'media-cache-size-in-bytes',+ 'offthreadvideo-cache-size-in-bytes',+ 'offthreadvideo-video-threads',+ 'enable-multiprocess-on-linux',+ 'repro',+ 'sample-rate',+ 'for-seamless-aac-concatenation','beep-on-finish','ipv4','number-of-shared-audio-tags',@@ -400,21 +437,21 @@ const commandHelp: readonly CommandHelpEntry[] = [args: '',description: 'Print and validate versions of all Remotion packages.',documentation: 'https://www.remotion.dev/docs/cli/versions',- options: [],+ options: options(['log']),},{path: ['upgrade'],args: '',description: 'Ensure Remotion is on the newest version.',documentation: 'https://www.remotion.dev/docs/cli/upgrade',- options: options(['package-manager', 'version', 'skip-skills']),+ options: options(['package-manager', 'version', 'skip-skills', 'log']),},{path: ['add'],args: ' <package-name...>',description: 'Add Remotion packages with the correct version.',documentation: 'https://www.remotion.dev/docs/cli/add',- options: options(['package-manager']),+ options: options(['package-manager', 'log']),},{path: [GPU_COMMAND],@@ -452,7 +489,7 @@ const commandHelp: readonly CommandHelpEntry[] = [},{path: ['help'],- args: '',+ args: ' <command...>',description: 'Print available commands and flags for the Remotion CLI.',documentation: 'https://www.remotion.dev/docs/cli/help',options: [],@@ -463,18 +500,21 @@ export const printHelp = (logLevel: LogLevel,selectedPath: readonly string[],) => {- Log.info({indent: false, logLevel}, `@remotion/cli ${packagejson.version}`);- Log.info(- {indent: false, logLevel},- `© ${new Date().getFullYear()} Remotion AG`,- );+ if (selectedPath.length === 0) {+ Log.info({indent: false, logLevel}, `@remotion/cli ${packagejson.version}`);+ Log.info(+ {indent: false, logLevel},+ `© ${new Date().getFullYear()} Remotion AG`,+ );+ }- for (const line of getCommandHelp({+ const lines = getCommandHelp({binaryName: 'remotion',commands: commandHelp,selectedPath,rootDocumentation: 'https://www.remotion.dev/docs/cli',- })) {+ });+ for (const line of selectedPath.length === 0 ? lines : lines.slice(1)) {Log.info({indent: false, logLevel}, line);}};diff --git a/packages/cli/src/test/help.test.ts b/packages/cli/src/test/help.test.tsdeleted file mode 100644index 26bcf09d01..0000000000--- a/packages/cli/src/test/help.test.ts+++ /dev/null@@ -1,182 +0,0 @@-import {expect, test} from 'bun:test';-import {spawnSync} from 'node:child_process';-import {mkdtempSync, readdirSync, rmSync, writeFileSync} from 'node:fs';-import {tmpdir} from 'node:os';-import path from 'node:path';--const cliPath = path.join(__dirname, '..', '..', 'remotion-cli.js');--const commandHelpPages: readonly {- args: readonly string[];- documentation: string;- options: readonly string[];- excludedOptions?: readonly string[];-}[] = [- {- args: ['render'],- documentation: '/docs/cli/render',- options: ['--codec', '--sequence', '--public-path', '--public-license-key'],- },- {- args: ['studio'],- documentation: '/docs/cli/studio',- options: ['--editor', '--port'],- },- {- args: ['preview'],- documentation: '/docs/cli/studio',- options: ['--editor', '--port'],- },- {- args: ['still'],- documentation: '/docs/cli/still',- options: ['--frame', '--image-format', '--height', '--audio-latency-hint'],- },- {- args: ['compositions'],- documentation: '/docs/cli/compositions',- options: ['--props', '--browser-executable', '--gl'],- },- {args: ['lambda'], documentation: '/docs/lambda/cli', options: []},- {- args: ['bundle'],- documentation: '/docs/cli/bundle',- options: ['--out-dir', '--bundle-cache', '--quiet'],- },- {args: ['browser'], documentation: '/docs/cli/browser', options: []},- {- args: ['browser', 'ensure'],- documentation: '/docs/cli/browser/ensure',- options: ['--browser-executable', '--quiet'],- excludedOptions: ['--chrome-mode'],- },- {args: ['cloudrun'], documentation: '/docs/cloudrun/cli', options: []},- {- args: ['benchmark'],- documentation: '/docs/cli/benchmark',- options: ['--runs', '--concurrencies', '--concurrency', '--x264-preset'],- excludedOptions: ['--audio-codec'],- },- {args: ['skills'], documentation: '/docs/cli/skills', options: []},- {args: ['skills', 'add'], documentation: '/docs/cli/skills', options: []},- {args: ['skills', 'update'], documentation: '/docs/cli/skills', options: []},- {args: ['versions'], documentation: '/docs/cli/versions', options: []},- {- args: ['upgrade'],- documentation: '/docs/cli/upgrade',- options: ['--package-manager'],- },- {- args: ['add'],- documentation: '/docs/cli/add',- options: ['--package-manager'],- },- {- args: ['gpu'],- documentation: '/docs/cli/gpu',- options: ['--gl', '--browser-executable', '--timeout', '--quiet'],- },- {args: ['ffmpeg'], documentation: '/docs/cli/ffmpeg', options: []},- {args: ['ffprobe'], documentation: '/docs/cli/ffprobe', options: []},- {args: ['help'], documentation: '/docs/cli/help', options: []},-] as const;--test('prints command-specific help without running the command', () => {- const temporaryDirectory = mkdtempSync(- path.join(tmpdir(), 'remotion-cli-help-'),- );- writeFileSync(- path.join(temporaryDirectory, 'remotion.config.ts'),- `throw new Error('The config file must not be loaded for --help');\n`,- );- const initialFiles = readdirSync(temporaryDirectory);- const childEnvironment: NodeJS.ProcessEnv = {...process.env, NO_COLOR: '1'};- delete childEnvironment.FORCE_COLOR;-- try {- for (const {- args,- documentation,- options,- excludedOptions = [],- } of commandHelpPages) {- for (const invocation of [- [...args, '--help'],- ['help', ...args],- ]) {- const result = spawnSync(- 'node',- [cliPath, ...invocation, '--log=error'],- {- cwd: temporaryDirectory,- encoding: 'utf8',- env: childEnvironment,- stdio: ['ignore', 'pipe', 'pipe'],- timeout: 10_000,- },- );-- if (result.error) {- throw result.error;- }-- expect(result.signal).toBeNull();- expect(result.status).toBe(0);- expect(result.stderr).toBe('');- expect(result.stdout).toContain(`remotion ${args.join(' ')}`);- expect(result.stdout).toContain(- `https://www.remotion.dev${documentation}`,- );- expect(result.stdout).not.toContain('Available commands:');- expect(result.stdout).toContain('Options:');- for (const option of ['--help', ...options]) {- const optionLine = result.stdout.split('\n').find((line) => {- const trimmed = line.trimStart();- return (- trimmed.startsWith(`${option} `) ||- trimmed.startsWith(`${option},`)- );- });- if (!optionLine) {- throw new Error(- `Expected \`remotion ${invocation.join(' ')}\` to document ${option}`,- );- }- }-- for (const option of excludedOptions) {- expect(result.stdout).not.toContain(option);- }- }- }-- const helpCommandResult = spawnSync(- 'node',- [cliPath, 'help', '--log=error'],- {- cwd: temporaryDirectory,- encoding: 'utf8',- env: childEnvironment,- stdio: ['ignore', 'pipe', 'pipe'],- timeout: 10_000,- },- );-- if (helpCommandResult.error) {- throw helpCommandResult.error;- }-- expect(helpCommandResult.signal).toBeNull();- expect(helpCommandResult.status).toBe(0);- expect(helpCommandResult.stderr).toBe('');- expect(helpCommandResult.stdout).toContain('Available commands:');- expect(helpCommandResult.stdout).toContain('remotion render');- expect(helpCommandResult.stdout).toContain(- 'https://www.remotion.dev/docs/cli',- );-- expect(readdirSync(temporaryDirectory)).toEqual(initialFiles);- } finally {- rmSync(temporaryDirectory, {recursive: true, force: true});- }-}, 60_000);diff --git a/packages/cloudrun/src/cli/args.ts b/packages/cloudrun/src/cli/args.tsindex 54cb115dd7..9d991d24e7 100644--- a/packages/cloudrun/src/cli/args.ts+++ b/packages/cloudrun/src/cli/args.ts@@ -5,6 +5,7 @@ import type {GcpRegion} from '../pricing/gcp-regions';const CloudrunBooleanFlags = [...CliInternals.BooleanFlags,'force',+ 'f','yes','y','onlyAllocateCpuDuringRequestProcessing',diff --git a/packages/cloudrun/src/cli/commands/sites/create.ts b/packages/cloudrun/src/cli/commands/sites/create.tsindex b895914841..4d30f00d8a 100644--- a/packages/cloudrun/src/cli/commands/sites/create.ts+++ b/packages/cloudrun/src/cli/commands/sites/create.ts@@ -24,8 +24,12 @@ import {import {quit} from '../../helpers/quit';import {Log} from '../../log';-const {disableGitSourceOption, askAIOption, keyboardShortcutsOption} =- BrowserSafeApis.options;+const {+ disableGitSourceOption,+ askAIOption,+ keyboardShortcutsOption,+ rspackOption,+} = BrowserSafeApis.options;export {SITES_CREATE_SUBCOMMAND} from '../command-names';@@ -185,6 +189,9 @@ export const sitesCreateSubcommand = async (enableCaching: BrowserSafeApis.options.bundleCacheOption.getValue({commandLine: CliInternals.parsedCli,}).value,+ rspack: rspackOption.getValue({+ commandLine: CliInternals.parsedCli,+ }).value,bundlerOverride: ConfigInternals.getBundlerOverrideFn(),rspackOverride: ConfigInternals.getRspackOverrideFn(),webpackOverride: ConfigInternals.getWebpackOverrideFn() ?? ((f) => f),diff --git a/packages/cloudrun/src/cli/help.ts b/packages/cloudrun/src/cli/help.tsindex 5418a1cb9e..26346956e6 100644--- a/packages/cloudrun/src/cli/help.ts+++ b/packages/cloudrun/src/cli/help.ts@@ -84,6 +84,10 @@ const cloudrunOnlyOptions = {flag: '--quiet, -q',description: 'Reduce console output.',},+ force: {+ flag: '--force, -f',+ description: 'Skip deletion confirmation prompts.',+ },yes: {flag: '--yes, -y',description: 'Skip deletion confirmation prompts.',@@ -106,7 +110,11 @@ const options = (const cloudrunOnlyOption =cloudrunOnlyOptions[flag as keyof typeof cloudrunOnlyOptions];if (cloudrunOnlyOption) {- return cloudrunOnlyOption;+ return {+ ...cloudrunOnlyOption,+ description:+ descriptionOverrides[flag] ?? cloudrunOnlyOption.description,+ };}const rendererOption = rendererOptions.find(@@ -165,6 +173,8 @@ const renderOptions = options('gl','disable-headless','dark-mode',+ 'config',+ 'port','timeout','binaries-directory','muted',@@ -177,7 +187,10 @@ const renderOptions = options('metadata','sample-rate',],- {'image-format': 'Video Image Format'},+ {+ 'image-format': 'Video Image Format',+ port: 'Set the local server port when no composition ID is passed.',+ },);const commandHelp = [@@ -200,37 +213,44 @@ const commandHelp = [args: ' <serve-url|site-name> [<still-id>] [<output-location>]',description: 'Render a Remotion still on GCP Cloud Run.',documentation: 'https://www.remotion.dev/docs/cloudrun/cli/still',- options: options([- 'region',- 'props',- 'frame',- 'privacy',- 'force-bucket-name',- 'height',- 'width',- 'fps',- 'duration',- 'jpeg-quality',- 'image-format',- 'scale',- 'env-file',- 'out-name',- 'cloud-run-url',- 'service-name',- 'browser-executable',- 'user-agent',- 'disable-web-security',- 'ignore-certificate-errors',- 'enable-multiprocess-on-linux',- 'gl',- 'disable-headless',- 'dark-mode',- 'timeout',- 'binaries-directory',- 'quiet',- 'media-cache-size-in-bytes',- 'offthreadvideo-cache-size-in-bytes',- ]),+ options: options(+ [+ 'region',+ 'props',+ 'frame',+ 'privacy',+ 'force-bucket-name',+ 'height',+ 'width',+ 'fps',+ 'duration',+ 'jpeg-quality',+ 'image-format',+ 'scale',+ 'env-file',+ 'out-name',+ 'cloud-run-url',+ 'service-name',+ 'browser-executable',+ 'user-agent',+ 'disable-web-security',+ 'ignore-certificate-errors',+ 'enable-multiprocess-on-linux',+ 'gl',+ 'disable-headless',+ 'dark-mode',+ 'config',+ 'port',+ 'timeout',+ 'binaries-directory',+ 'quiet',+ 'media-cache-size-in-bytes',+ 'offthreadvideo-cache-size-in-bytes',+ ],+ {+ port: 'Set the local server port when no composition ID is passed.',+ },+ ),},{path: [SERVICES_COMMAND],@@ -267,14 +287,14 @@ const commandHelp = [args: ' <service-name...>',description: 'Delete one or more Cloud Run services.',documentation: 'https://www.remotion.dev/docs/cloudrun/cli/services/rm',- options: options(['region', 'yes']),+ options: options(['region', 'yes', 'force', 'quiet']),},{path: [SERVICES_COMMAND, SERVICES_RMALL_SUBCOMMAND],args: '',description: 'Delete all Cloud Run services in the selected region.',documentation: 'https://www.remotion.dev/docs/cloudrun/cli/services/rmall',- options: options(['region', 'yes']),+ options: options(['region', 'yes', 'force', 'quiet']),},{path: [SITES_COMMAND],@@ -288,17 +308,23 @@ const commandHelp = [args: ' <entry-point>?',description: 'Bundle and upload a Remotion project.',documentation: 'https://www.remotion.dev/docs/cloudrun/cli/sites/create',- options: options([- 'region',- 'site-name',- 'privacy',- 'disable-git-source',- 'bundle-cache',- 'rspack',- 'disable-ask-ai',- 'disable-keyboard-shortcuts',- 'quiet',- ]),+ options: options(+ [+ 'region',+ 'site-name',+ 'privacy',+ 'config',+ 'disable-git-source',+ 'bundle-cache',+ 'rspack',+ 'disable-ask-ai',+ 'disable-keyboard-shortcuts',+ 'quiet',+ ],+ {+ privacy: 'Set the privacy of the deployed site.',+ },+ ),},{path: [SITES_COMMAND, SITES_LS_SUBCOMMAND],@@ -312,14 +338,14 @@ const commandHelp = [args: ' <site-name...>',description: 'Delete one or more deployed Remotion projects.',documentation: 'https://www.remotion.dev/docs/cloudrun/cli/sites/rm',- options: options(['region', 'yes']),+ options: options(['region', 'yes', 'force', 'quiet']),},{path: [SITES_COMMAND, SITES_RMALL_COMMAND],args: '',description: 'Delete all deployed Remotion projects.',documentation: 'https://www.remotion.dev/docs/cloudrun/cli/sites/rmall',- options: options(['region', 'all-regions', 'yes']),+ options: options(['region', 'all-regions', 'yes', 'force']),},{path: [PERMISSIONS_COMMAND],diff --git a/packages/cloudrun/src/test/cli-help.test.ts b/packages/cloudrun/src/test/cli-help.test.tsindex 6a1c3f103d..af5eef08e2 100644--- a/packages/cloudrun/src/test/cli-help.test.ts+++ b/packages/cloudrun/src/test/cli-help.test.ts@@ -1,11 +1,6 @@import {expect, test} from 'bun:test';-import {spawnSync} from 'node:child_process';-import {mkdtempSync, readdirSync, rmSync, writeFileSync} from 'node:fs';-import path from 'node:path';import {getCloudrunHelp} from '../cli/help';-const exampleDirectory = path.join(__dirname, '..', '..', '..', 'example');-const commandHelpPages = [{args: [], documentation: '/docs/cloudrun/cli', option: null},{@@ -98,97 +93,45 @@ test('defines help for every Cloud Run command', () => {const renderHelp = getCloudrunHelp(['render']).join('\n');expect(renderHelp).toContain('--buffer-size <value>');expect(renderHelp).toContain('--browser-executable <value>');+ expect(renderHelp).toContain('--config <value>');+ expect(renderHelp).toContain('--port <value>');expect(renderHelp).toContain('--quiet, -q');const stillHelp = getCloudrunHelp(['still']).join('\n');expect(stillHelp).toContain('--frame <value>');expect(stillHelp).toContain('--height <value>');+ expect(stillHelp).toContain('--config <value>');+ expect(stillHelp).toContain('--port <value>');expect(stillHelp).not.toContain('--offthreadvideo-video-threads');const createSiteHelp = getCloudrunHelp(['sites', 'create']).join('\n');+ expect(createSiteHelp).toContain('--config <value>');expect(createSiteHelp).toContain('--bundle-cache');expect(createSiteHelp).toContain('--disable-ask-ai');-});--test('exposes a help-only package entry point', () => {- const result = spawnSync(- 'node',- [- '-e',- `const help = require('@remotion/cloudrun/internal/help'); process.stdout.write(JSON.stringify({printHelp: typeof help.printHelp, hasRenderOptions: help.getCloudrunHelp(['render']).join('\\n').includes('--service-name <service-name>')}));`,- ],- {- cwd: exampleDirectory,- encoding: 'utf8',- stdio: ['ignore', 'pipe', 'pipe'],- timeout: 10_000,- },+ expect(createSiteHelp).toContain('--privacy <public|private|no-acl>');+ expect(createSiteHelp).toContain('Set the privacy of the deployed site.');+ expect(createSiteHelp).not.toContain(+ 'Set the privacy of the rendered output.',);- if (result.error) {- throw result.error;+ for (const args of [+ ['services', 'rm'],+ ['services', 'rmall'],+ ['sites', 'rm'],+ ['sites', 'rmall'],+ ]) {+ expect(getCloudrunHelp(args).join('\n')).toContain('--force, -f');}- expect(result.signal).toBeNull();- expect(result.status).toBe(0);- expect(JSON.parse(result.stdout)).toEqual({- printHelp: 'function',- hasRenderOptions: true,- });-});+ for (const args of [+ ['services', 'rm'],+ ['services', 'rmall'],+ ['sites', 'rm'],+ ]) {+ expect(getCloudrunHelp(args).join('\n')).toContain('--quiet, -q');+ }-test('the Remotion CLI delegates Cloud Run help before loading config', () => {- const temporaryDirectory = mkdtempSync(- path.join(exampleDirectory, '.tmp-cloudrun-cli-help-'),- );- writeFileSync(path.join(temporaryDirectory, 'package.json'), '{}\n');- writeFileSync(- path.join(temporaryDirectory, 'remotion.config.ts'),- `throw new Error('The config file must not be loaded for --help');\n`,+ expect(getCloudrunHelp(['sites', 'rmall']).join('\n')).not.toContain(+ '--quiet, -q',);- const initialFiles = readdirSync(temporaryDirectory);- const childEnvironment: NodeJS.ProcessEnv = {...process.env, NO_COLOR: '1'};- delete childEnvironment.FORCE_COLOR;-- try {- for (const invocation of [- ['cloudrun', 'render', '--help'],- ['help', 'cloudrun', 'render'],- ]) {- const result = spawnSync(- 'node',- [- path.join(exampleDirectory, '..', 'cli', 'remotion-cli.js'),- ...invocation,- '--log=error',- ],- {- cwd: temporaryDirectory,- encoding: 'utf8',- env: childEnvironment,- stdio: ['ignore', 'pipe', 'pipe'],- timeout: 10_000,- },- );-- if (result.error) {- throw result.error;- }-- expect(result.signal).toBeNull();- expect(result.status).toBe(0);- expect(result.stderr).toBe('');- expect(result.stdout).toStartWith('remotion cloudrun render ');- expect(result.stdout).not.toContain('©');- expect(result.stdout).toContain('remotion cloudrun render');- expect(result.stdout).toContain('--service-name <service-name>');- expect(result.stdout).toContain(- 'https://www.remotion.dev/docs/cloudrun/cli/render',- );- }-- expect(readdirSync(temporaryDirectory)).toEqual(initialFiles);- } finally {- rmSync(temporaryDirectory, {recursive: true, force: true});- }-}, 15_000);+});diff --git a/packages/lambda/src/cli/args.ts b/packages/lambda/src/cli/args.tsindex ea1b477ee8..d07ec808d1 100644--- a/packages/lambda/src/cli/args.ts+++ b/packages/lambda/src/cli/args.ts@@ -7,6 +7,7 @@ import type {AwsRegion, DeleteAfter, RuntimePreference} from '../client';const LambdaBooleanFlags = [...CliInternals.BooleanFlags,'force',+ 'f','disable-cloudwatch','enable-lambda-insights','yes',diff --git a/packages/lambda/src/cli/commands/sites/create.ts b/packages/lambda/src/cli/commands/sites/create.tsindex 25592edad9..3790b5f399 100644--- a/packages/lambda/src/cli/commands/sites/create.ts+++ b/packages/lambda/src/cli/commands/sites/create.ts@@ -36,6 +36,7 @@ const {disableGitSourceOption,askAIOption,keyboardShortcutsOption,+ rspackOption,} = BrowserSafeApis.options;export const sitesCreateSubcommand = async (@@ -219,6 +220,9 @@ export const sitesCreateSubcommand = async (enableCaching: BrowserSafeApis.options.bundleCacheOption.getValue({commandLine: CliInternals.parsedCli,}).value,+ rspack: rspackOption.getValue({+ commandLine: CliInternals.parsedCli,+ }).value,bundlerOverride: ConfigInternals.getBundlerOverrideFn(),rspackOverride: ConfigInternals.getRspackOverrideFn(),webpackOverride: ConfigInternals.getWebpackOverrideFn() ?? ((f) => f),diff --git a/packages/lambda/src/cli/help.ts b/packages/lambda/src/cli/help.tsindex 51436f9fd1..7a8ab751cd 100644--- a/packages/lambda/src/cli/help.ts+++ b/packages/lambda/src/cli/help.ts@@ -193,6 +193,8 @@ const commandHelp = ['region','enable-cancellation','props',+ 'config',+ 'port','log','privacy','max-retries',@@ -253,10 +255,14 @@ const commandHelp = ['force-path-style','storage-class','license-key',+ 'is-production','binaries-directory','quiet',],- {'image-format': 'Video Image Format'},+ {+ 'image-format': 'Video Image Format',+ port: 'Set a custom port when selecting a composition interactively.',+ },),},{@@ -264,46 +270,54 @@ const commandHelp = [args: ' <serve-url> [<composition-id>] [<output-location>]',description: 'Render a still image in the cloud.',documentation: 'https://www.remotion.dev/docs/lambda/cli/still',- options: options([- 'frame',- 'region',- 'props',- 'env-file',- 'scale',- 'log',- 'privacy',- 'max-retries',- 'out-name',- 's3-output-provider-endpoint',- 's3-output-provider-region',- 's3-output-provider-force-path-style',- 'image-format',- 'jpeg-quality',- 'timeout',- 'height',- 'width',- 'fps',- 'duration',- 'function-name',- 'force-bucket-name',- 'browser-executable',- 'ignore-certificate-errors',- 'disable-web-security',- 'disable-headless',- 'dark-mode',- 'gl',- 'enable-multiprocess-on-linux',- 'user-agent',- 'media-cache-size-in-bytes',- 'offthreadvideo-cache-size-in-bytes',- 'offthreadvideo-video-threads',- 'delete-after',- 'force-path-style',- 'storage-class',- 'license-key',- 'binaries-directory',- 'quiet',- ]),+ options: options(+ [+ 'frame',+ 'region',+ 'props',+ 'config',+ 'port',+ 'env-file',+ 'scale',+ 'log',+ 'privacy',+ 'max-retries',+ 'out-name',+ 's3-output-provider-endpoint',+ 's3-output-provider-region',+ 's3-output-provider-force-path-style',+ 'image-format',+ 'jpeg-quality',+ 'timeout',+ 'height',+ 'width',+ 'fps',+ 'duration',+ 'function-name',+ 'force-bucket-name',+ 'browser-executable',+ 'ignore-certificate-errors',+ 'disable-web-security',+ 'disable-headless',+ 'dark-mode',+ 'gl',+ 'enable-multiprocess-on-linux',+ 'user-agent',+ 'media-cache-size-in-bytes',+ 'offthreadvideo-cache-size-in-bytes',+ 'offthreadvideo-video-threads',+ 'delete-after',+ 'force-path-style',+ 'storage-class',+ 'license-key',+ 'is-production',+ 'binaries-directory',+ 'quiet',+ ],+ {+ port: 'Set a custom port when selecting a composition interactively.',+ },+ ),},{path: [COMPOSITIONS_COMMAND],@@ -395,6 +409,7 @@ const commandHelp = ['site-name','force-bucket-name','site-privacy',+ 'config','public-dir','enable-folder-expiry','throw-if-site-exists',diff --git a/packages/lambda/src/test/unit/cli-help.test.ts b/packages/lambda/src/test/unit/cli-help.test.tsindex f5c6f30f6c..8bb0d1a4ba 100644--- a/packages/lambda/src/test/unit/cli-help.test.ts+++ b/packages/lambda/src/test/unit/cli-help.test.ts@@ -1,18 +1,6 @@import {expect, test} from 'bun:test';-import {spawnSync} from 'node:child_process';-import {mkdtempSync, readdirSync, rmSync, writeFileSync} from 'node:fs';-import path from 'node:path';import {getLambdaHelp} from '../../cli/help';-const exampleDirectory = path.join(- __dirname,- '..',- '..',- '..',- '..',- 'example',-);-const commandHelpPages = [{args: [], documentation: '/docs/lambda/cli', option: null},{@@ -131,10 +119,16 @@ test('defines help for every Lambda command', () => {const renderHelp = getLambdaHelp(['render']).join('\n');expect(renderHelp).toContain('--buffer-size <value>');expect(renderHelp).toContain('--enable-multiprocess-on-linux');+ expect(renderHelp).toContain('--is-production');+ expect(renderHelp).toContain('--config <value>');+ expect(renderHelp).toContain('--port <value>');const stillHelp = getLambdaHelp(['still']).join('\n');expect(stillHelp).toContain('--function-name <name>');expect(stillHelp).toContain('--height <value>');+ expect(stillHelp).toContain('--is-production');+ expect(stillHelp).toContain('--config <value>');+ expect(stillHelp).toContain('--port <value>');const compositionsHelp = getLambdaHelp(['compositions']).join('\n');expect(compositionsHelp).toContain('--region <region>');@@ -154,6 +148,7 @@ test('defines help for every Lambda command', () => {const createSiteHelp = getLambdaHelp(['sites', 'create']).join('\n');expect(createSiteHelp).toContain('--privacy <public|no-acl>');+ expect(createSiteHelp).toContain('--config <value>');expect(createSiteHelp).not.toContain('public|private|no-acl');const listSitesHelp = getLambdaHelp(['sites', 'ls']).join('\n');@@ -162,86 +157,3 @@ test('defines help for every Lambda command', () => {const policyHelp = getLambdaHelp(['policies', 'validate']).join('\n');expect(policyHelp).toContain('--region <region>');});--test('exposes a help-only package entry point', () => {- const result = spawnSync(- 'node',- [- '-e',- `const help = require('@remotion/lambda/internal/help'); process.stdout.write(JSON.stringify({printHelp: typeof help.printHelp, hasRenderOptions: help.getLambdaHelp(['render']).join('\\n').includes('--frames-per-lambda <count>')}));`,- ],- {- cwd: exampleDirectory,- encoding: 'utf8',- stdio: ['ignore', 'pipe', 'pipe'],- timeout: 10_000,- },- );-- if (result.error) {- throw result.error;- }-- expect(result.signal).toBeNull();- expect(result.status).toBe(0);- expect(JSON.parse(result.stdout)).toEqual({- printHelp: 'function',- hasRenderOptions: true,- });-});--test('the Remotion CLI delegates Lambda help before loading config', () => {- const temporaryDirectory = mkdtempSync(- path.join(exampleDirectory, '.tmp-lambda-cli-help-'),- );- writeFileSync(path.join(temporaryDirectory, 'package.json'), '{}\n');- writeFileSync(- path.join(temporaryDirectory, 'remotion.config.ts'),- `throw new Error('The config file must not be loaded for --help');\n`,- );- const initialFiles = readdirSync(temporaryDirectory);- const childEnvironment: NodeJS.ProcessEnv = {...process.env, NO_COLOR: '1'};- delete childEnvironment.FORCE_COLOR;-- try {- for (const invocation of [- ['lambda', 'render', '--help'],- ['help', 'lambda', 'render'],- ]) {- const result = spawnSync(- 'node',- [- path.join(exampleDirectory, '..', 'cli', 'remotion-cli.js'),- ...invocation,- '--log=error',- ],- {- cwd: temporaryDirectory,- encoding: 'utf8',- env: childEnvironment,- stdio: ['ignore', 'pipe', 'pipe'],- timeout: 10_000,- },- );-- if (result.error) {- throw result.error;- }-- expect(result.signal).toBeNull();- expect(result.status).toBe(0);- expect(result.stderr).toBe('');- expect(result.stdout).toStartWith('remotion lambda render ');- expect(result.stdout).not.toContain('©');- expect(result.stdout).toContain('remotion lambda render');- expect(result.stdout).toContain('--frames-per-lambda <count>');- expect(result.stdout).toContain(- 'https://www.remotion.dev/docs/lambda/cli/render',- );- }-- expect(readdirSync(temporaryDirectory)).toEqual(initialFiles);- } finally {- rmSync(temporaryDirectory, {recursive: true, force: true});- }-}, 15_000);