Skip to content

🎥 Make videos programmatically with React

make a testbed

Jonny Burger101bd30c4f7d
diff --git a/packages/example/src/CodemodTestbed.tsx b/packages/example/src/CodemodTestbed.tsx
new file mode 100644
index 0000000000..7c95f099bc
--- /dev/null
+++ b/packages/example/src/CodemodTestbed.tsx
@@ -0,0 +1,42 @@
+import React, {useCallback} from 'react';
+import {CalculateMetadataFunction, Composition} from 'remotion';
+import {z} from 'zod';
+import {DynamicDuration, dynamicDurationSchema} from './DynamicDuration';
+
+// Use this file to test codemods such as renames
+export const CodemodRoot: React.FC = () => {
+ const calculateMetadata: CalculateMetadataFunction<
+ z.infer<typeof dynamicDurationSchema>
+ > = useCallback(async ({props}) => {
+ return {
+ durationInFrames: props.duration,
+ fps: 30,
+ };
+ }, []);
+
+ return (
+ <>
+ <Composition
+ id="one"
+ component={DynamicDuration}
+ width={1080}
+ height={1080}
+ fps={30}
+ durationInFrames={100}
+ calculateMetadata={calculateMetadata}
+ schema={dynamicDurationSchema}
+ defaultProps={{duration: 50}}
+ />
+ <Composition
+ id="two"
+ component={DynamicDuration}
+ width={1080}
+ height={1080}
+ fps={30}
+ durationInFrames={100}
+ schema={dynamicDurationSchema}
+ defaultProps={{duration: 50}}
+ />
+ </>
+ );
+};
diff --git a/packages/example/src/codemod-entry.tsx b/packages/example/src/codemod-entry.tsx
new file mode 100644
index 0000000000..3484c46d0c
--- /dev/null
+++ b/packages/example/src/codemod-entry.tsx
@@ -0,0 +1,4 @@
+import {registerRoot} from 'remotion';
+import {CodemodRoot} from './CodemodTestbed';
+
+registerRoot(CodemodRoot);