Skip to content

🎥 Make videos programmatically with React

remove unnecessary async function

Jonny Burger1812089fb62d
diff --git a/packages/cli/src/get-cli-options.ts b/packages/cli/src/get-cli-options.ts
index 3e0b866183..45cdad70c0 100644
--- a/packages/cli/src/get-cli-options.ts
+++ b/packages/cli/src/get-cli-options.ts
@@ -166,7 +166,7 @@ export const getCliOptions = async (options: {
frameRange,
shouldOutputImageSequence,
inputProps: getInputProps(null, options.logLevel),
- envVariables: await getEnvironmentVariables(null, options.logLevel),
+ envVariables: getEnvironmentVariables(null, options.logLevel),
jpegQuality: ConfigInternals.getJpegQuality(),
browser: await getAndValidateBrowser({
browserExecutable,
diff --git a/packages/cli/src/get-env.ts b/packages/cli/src/get-env.ts
index 6b320c9e99..4062cfab37 100644
--- a/packages/cli/src/get-env.ts
+++ b/packages/cli/src/get-env.ts
@@ -1,7 +1,7 @@
import type {LogLevel} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
import dotenv from 'dotenv';
-import fs from 'node:fs';
+import fs, {readFileSync} from 'node:fs';
import path from 'node:path';
import {chalk} from './chalk';
import {ConfigInternals} from './config';
@@ -65,14 +65,14 @@ const watchEnvFile = ({
return unwatch;
};
-const getEnvForEnvFile = async (
+const getEnvForEnvFile = (
processEnv: ReturnType<typeof getProcessEnv>,
envFile: string,
onUpdate: null | ((newProps: Record<string, string>) => void),
logLevel: LogLevel,
) => {
try {
- const envFileData = await fs.promises.readFile(envFile);
+ const envFileData = readFileSync(envFile);
if (onUpdate) {
if (typeof fs.watchFile === 'undefined') {
Log.warn(
@@ -98,7 +98,7 @@ const getEnvForEnvFile = async (
export const getEnvironmentVariables = (
onUpdate: null | ((newProps: Record<string, string>) => void),
logLevel: LogLevel,
-): Promise<Record<string, string>> => {
+): Record<string, string> => {
const processEnv = getProcessEnv();
if (parsedCli['env-file']) {
@@ -148,7 +148,7 @@ export const getEnvironmentVariables = (
}
}
- return Promise.resolve(processEnv);
+ return processEnv;
}
return getEnvForEnvFile(processEnv, defaultEnvFile, onUpdate, logLevel);
diff --git a/packages/cli/src/studio.ts b/packages/cli/src/studio.ts
index 251098fab8..3b4d1a6e8e 100644
--- a/packages/cli/src/studio.ts
+++ b/packages/cli/src/studio.ts
@@ -106,7 +106,7 @@ export const studioCommand = async (
});
});
}, logLevel);
- let envVariables = await getEnvironmentVariables((newEnvVariables) => {
+ let envVariables = getEnvironmentVariables((newEnvVariables) => {
waitForLiveEventsListener().then((listener) => {
envVariables = newEnvVariables;
listener.sendEventToClient({