🎥 Make videos programmatically with React
apply env variablaes
Jonny Burger3a9125b08649
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModal.tsx b/packages/cli/src/editor/components/RenderModal/RenderModal.tsxindex 73f1c67768..4b2eba5448 100644--- a/packages/cli/src/editor/components/RenderModal/RenderModal.tsx+++ b/packages/cli/src/editor/components/RenderModal/RenderModal.tsx@@ -242,7 +242,9 @@ export const RenderModal: React.FC<{useState<AudioCodec | null>(() => initialAudioCodec);const [envVariables, setEnvVariables] = useState<[string, string][]>(() =>- envVariablesObjectToArray(initialEnvVariables)+ envVariablesObjectToArray(initialEnvVariables).filter(+ ([key]) => key !== 'NODE_ENV'+ ));const [videoCodecForAudioTab, setVideoCodecForAudioTab] = useState<Codec>(() => initialVideoCodecForAudioTabdiff --git a/packages/cli/src/editor/helpers/convert-env-variables.ts b/packages/cli/src/editor/helpers/convert-env-variables.tsindex ae22458221..ede600ec98 100644--- a/packages/cli/src/editor/helpers/convert-env-variables.ts+++ b/packages/cli/src/editor/helpers/convert-env-variables.ts@@ -10,8 +10,11 @@ export const envVariablesObjectToArray = (export const envVariablesArrayToObject = (envVariables: [string, string][]): Record<string, string> => {- return envVariables.reduce((acc, [key, value]) => {- acc[key] = value;- return acc;- }, {} as Record<string, string>);+ return envVariables+ .map(([key, val]) => [key.trim(), val.trim()])+ .filter(([key, val]) => key && val)+ .reduce((acc, [key, value]) => {+ acc[key] = value;+ return acc;+ }, {} as Record<string, string>);};diff --git a/packages/cli/src/preview-server/render-queue/process-still.ts b/packages/cli/src/preview-server/render-queue/process-still.tsindex c60d3a21fb..fd4c0af99e 100644--- a/packages/cli/src/preview-server/render-queue/process-still.ts+++ b/packages/cli/src/preview-server/render-queue/process-still.ts@@ -23,8 +23,6 @@ export const processStill = async ({const {publicDir,browserExecutable,- // TODO: Accept env variables from UI- envVariables,// TODO: Accept input props from UIinputProps,port,@@ -46,7 +44,7 @@ export const processStill = async ({browserExecutable,chromiumOptions: job.chromiumOptions,entryPointReason: 'same as preview',- envVariables,+ envVariables: job.envVariables,height: null,fullEntryPoint,inputProps,diff --git a/packages/cli/src/preview-server/render-queue/process-video.ts b/packages/cli/src/preview-server/render-queue/process-video.tsindex 2c14256796..874080ae86 100644--- a/packages/cli/src/preview-server/render-queue/process-video.ts+++ b/packages/cli/src/preview-server/render-queue/process-video.ts@@ -23,8 +23,6 @@ export const processVideoJob = async ({const {publicDir,browserExecutable,- // TODO: Accept env variables from UI- envVariables,// TODO: Accept input props from UIinputProps,port,@@ -45,7 +43,7 @@ export const processVideoJob = async ({browserExecutable,chromiumOptions: job.chromiumOptions,entryPointReason: 'same as preview',- envVariables,+ envVariables: job.envVariables,height: null,fullEntryPoint,inputProps,