Skip to content

🎥 Make videos programmatically with React

fix react-motion-render generation

Jonny Burger8b3256f89573
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 029ebca717..6347008278 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -204,8 +204,13 @@ export const render = async (remotionRoot: string, args: string[]) => {
);
const outputDir = shouldOutputImageSequence
- ? absoluteOutputFile
- : await fs.promises.mkdtemp(path.join(os.tmpdir(), 'react-motion-render'));
+ ? {dir: absoluteOutputFile, cleanup: false}
+ : {
+ dir: await fs.promises.mkdtemp(
+ path.join(os.tmpdir(), 'react-motion-render')
+ ),
+ cleanup: true,
+ };
Log.verbose('Output dir', outputDir);
@@ -289,7 +294,7 @@ export const render = async (remotionRoot: string, args: string[]) => {
Log.info('\nDownloading asset... ', src);
}
},
- outputDir,
+ outputDir: outputDir.dir,
serveUrl: urlOrBundle,
dumpBrowserLogs: RenderInternals.isEqualOrBelowLogLevel(
ConfigInternals.Logging.getLogLevel(),
@@ -368,6 +373,9 @@ export const render = async (remotionRoot: string, args: string[]) => {
try {
await cleanupBundle();
await RenderInternals.cleanDownloadMap(downloadMap);
+ if (outputDir.cleanup) {
+ await RenderInternals.deleteDirectory(outputDir.dir);
+ }
Log.verbose('Cleaned up', downloadMap.assetDir);
} catch (err) {