Skip to content

🎥 Make videos programmatically with React

fix again

Jonny Burger99671f87be78
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.ts
index 49bb7bff1d..a6a15eb315 100644
--- a/packages/cli/src/benchmark.ts
+++ b/packages/cli/src/benchmark.ts
@@ -5,7 +5,6 @@ import {
RenderInternals,
renderMedia,
} from '@remotion/renderer';
-import path from 'path';
import {chalk} from './chalk';
import {ConfigInternals} from './config';
import {findEntryPoint} from './entry-point';
@@ -150,8 +149,6 @@ export const benchmarkCommand = async (
process.exit(1);
}
- const fullPath = path.join(process.cwd(), file);
-
const {
inputProps,
envVariables,
@@ -184,7 +181,7 @@ export const benchmarkCommand = async (
const {urlOrBundle: bundleLocation, cleanup: cleanupBundle} =
await bundleOnCliOrTakeServeUrl({
- fullPath,
+ fullPath: file,
publicDir,
remotionRoot,
steps: ['bundling'],
diff --git a/packages/cli/src/compositions.ts b/packages/cli/src/compositions.ts
index 7fdcf9b958..0caf9ec8b6 100644
--- a/packages/cli/src/compositions.ts
+++ b/packages/cli/src/compositions.ts
@@ -1,5 +1,4 @@
import {getCompositions, RenderInternals} from '@remotion/renderer';
-import path from 'path';
import {findEntryPoint} from './entry-point';
import {getCliOptions} from './get-cli-options';
import {loadConfig} from './get-config-file-name';
@@ -28,8 +27,6 @@ export const listCompositionsCommand = async (
const downloadMap = RenderInternals.makeDownloadMap();
- const fullPath = path.join(process.cwd(), file);
-
await loadConfig(remotionRoot);
const {
@@ -51,7 +48,7 @@ export const listCompositionsCommand = async (
const {urlOrBundle: bundled, cleanup: cleanupBundle} =
await bundleOnCliOrTakeServeUrl({
remotionRoot,
- fullPath,
+ fullPath: file,
steps: ['bundling'],
publicDir,
});
diff --git a/packages/cli/src/entry-point.ts b/packages/cli/src/entry-point.ts
index 32f264c334..49c83f94ff 100644
--- a/packages/cli/src/entry-point.ts
+++ b/packages/cli/src/entry-point.ts
@@ -61,19 +61,28 @@ export const findEntryPoint = (
if (file) {
Log.verbose('Entry point from config file is', file);
- return {file, remainingArgs: args, reason: 'config file'};
+ return {
+ file: path.resolve(remotionRoot, file),
+ remainingArgs: args,
+ reason: 'config file',
+ };
}
// 3rd priority: Common paths
const found = findCommonPath(remotionRoot);
if (found) {
+ const absolutePath = path.resolve(remotionRoot, found);
Log.verbose(
'Selected',
- found,
+ absolutePath,
'as the entry point because file exists and is a common entry point and no entry point was explicitly selected'
);
- return {file: found, remainingArgs: args, reason: 'common paths'};
+ return {
+ file: absolutePath,
+ remainingArgs: args,
+ reason: 'common paths',
+ };
}
return {file: null, remainingArgs: args, reason: 'none found'};
diff --git a/packages/cli/src/preview.ts b/packages/cli/src/preview.ts
index a26dd16410..846ae33823 100644
--- a/packages/cli/src/preview.ts
+++ b/packages/cli/src/preview.ts
@@ -92,7 +92,6 @@ export const previewCommand = async (remotionRoot: string, args: string[]) => {
}
const desiredPort = getPort();
- const fullPath = path.join(process.cwd(), file);
let inputProps = getInputProps((newProps) => {
waitForLiveEventsListener().then((listener) => {
@@ -137,7 +136,7 @@ export const previewCommand = async (remotionRoot: string, args: string[]) => {
const {port, liveEventsServer} = await startServer({
entry: path.resolve(__dirname, 'previewEntry.js'),
- userDefinedComponent: fullPath,
+ userDefinedComponent: file,
getCurrentInputProps: () => inputProps,
getEnvVariables: () => envVariables,
port: desiredPort,
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index d7dc6a6545..814c00bf6e 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -48,10 +48,6 @@ export const still = async (remotionRoot: string, args: string[]) => {
process.exit(1);
}
- const fullPath = RenderInternals.isServeUrl(file)
- ? file
- : path.join(process.cwd(), file);
-
if (parsedCli.frames) {
Log.error(
'--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/'
@@ -95,12 +91,12 @@ export const still = async (remotionRoot: string, args: string[]) => {
});
const steps: RenderStep[] = [
- RenderInternals.isServeUrl(fullPath) ? null : ('bundling' as const),
+ RenderInternals.isServeUrl(file) ? null : ('bundling' as const),
'rendering' as const,
].filter(truthy);
const {cleanup: cleanupBundle, urlOrBundle} = await bundleOnCliOrTakeServeUrl(
- {fullPath, remotionRoot, steps, publicDir}
+ {fullPath: file, remotionRoot, steps, publicDir}
);
const puppeteerInstance = await browserInstance;