🎥 Make videos programmatically with React
use global scope for the cli command
Igor Samokhovetsa3ca500eeccf
diff --git a/packages/studio/src/helpers/make-render-command.ts b/packages/studio/src/helpers/make-render-command.tsindex 2e6bdfce72..d2e7bb18f7 100644--- a/packages/studio/src/helpers/make-render-command.ts+++ b/packages/studio/src/helpers/make-render-command.ts@@ -83,8 +83,8 @@ const addTrueBooleanFlagsIfChanged = (export const getNpmRemotionCommandPrefix = (version: string) => {return version.trim() === ''- ? 'npx -p @remotion/cli remotion'- : `npx -p @remotion/cli@${version} remotion`;+ ? 'npx --yes --location=global -p @remotion/cli remotion'+ : `npx --yes --location=global -p @remotion/cli@${version} remotion`;};export const normalizeServeUrlForRenderCommand = ({diff --git a/packages/studio/src/test/make-render-command.test.ts b/packages/studio/src/test/make-render-command.test.tsindex 5c388ec186..27ef693a83 100644--- a/packages/studio/src/test/make-render-command.test.ts+++ b/packages/studio/src/test/make-render-command.test.ts@@ -114,9 +114,11 @@ const getBaseInput = (): Parameters<test('Should map to npm-based command prefix', () => {expect(getNpmRemotionCommandPrefix('4.0.431')).toBe(- 'npx -p @remotion/[email protected] remotion',+ 'npx --yes --location=global -p @remotion/[email protected] remotion',+ );+ expect(getNpmRemotionCommandPrefix('')).toBe(+ 'npx --yes --location=global -p @remotion/cli remotion',);- expect(getNpmRemotionCommandPrefix('')).toBe('npx -p @remotion/cli remotion');});test('Should normalize serve URL by stripping selected composition', () => {@@ -151,7 +153,7 @@ test('Should generate concise read-only render command and omit concurrency', ()});expect(command).toContain(- "npx -p @remotion/[email protected] remotion render 'https://example.com' 'dynamic-length' 'video.mp4'",+ "npx --yes --location=global -p @remotion/[email protected] remotion render 'https://example.com' 'dynamic-length' 'video.mp4'",);expect(command).toContain("--frames='10-80'");expect(command).toContain('--muted');@@ -174,7 +176,7 @@ test('Should generate still command and omit default flags', () => {});expect(command).toContain(- "npx -p @remotion/[email protected] remotion still 'https://example.com/still' 'StillComp' 'still.png'",+ "npx --yes --location=global -p @remotion/[email protected] remotion still 'https://example.com/still' 'StillComp' 'still.png'",);expect(command).toContain("--frame='12'");expect(command).not.toContain("--image-format='png'");