Skip to content

πŸŽ₯ Make videos programmatically with React

update docs with new filename conventions

Jonny Burger665139e9f5c2
diff --git a/packages/docs/docs/brownfield-installation.md b/packages/docs/docs/brownfield-installation.md
index 947a2f3149..762f48b6dd 100644
--- a/packages/docs/docs/brownfield-installation.md
+++ b/packages/docs/docs/brownfield-installation.md
@@ -56,12 +56,12 @@ export const MyComposition = () => {
};
```
-```tsx twoslash title="remotion/Video.tsx"
+```tsx twoslash title="remotion/Root.tsx"
// @filename: Composition.tsx
export const MyComposition: React.FC = () => {
return null;
};
-// @filename: Video.tsx
+// @filename: Root.tsx
// ---cut---
import React from "react";
import { Composition } from "remotion";
@@ -88,7 +88,7 @@ export const RemotionRoot: React.FC = () => {
export const MyComposition: React.FC = () => {
return null;
};
-// @filename: Video.tsx
+// @filename: Root.tsx
import React from "react";
import { Composition } from "remotion";
import { MyComposition } from "./Composition";
@@ -110,7 +110,7 @@ export const RemotionRoot: React.FC = () => {
// @filename: index.ts
// ---cut---
import { registerRoot } from "remotion";
-import { RemotionRoot } from "./Video";
+import { RemotionRoot } from "./Root";
registerRoot(RemotionRoot);
```
diff --git a/packages/docs/docs/importing-assets.md b/packages/docs/docs/importing-assets.md
index 849523dccd..cf2bc44ec7 100644
--- a/packages/docs/docs/importing-assets.md
+++ b/packages/docs/docs/importing-assets.md
@@ -12,8 +12,8 @@ my-video/
β”‚ β”œβ”€ logo.png
β”œβ”€ src/
β”‚ β”œβ”€ MyComp.tsx
-β”‚ β”œβ”€ Video.tsx
-β”‚ β”œβ”€ index.tsx
+β”‚ β”œβ”€ Root.tsx
+β”‚ β”œβ”€ index.ts
β”œβ”€ package.json
```
@@ -61,7 +61,7 @@ my-video/
```
```tsx twoslash
-import { Img, useCurrentFrame, staticFile } from "remotion";
+import { Img, staticFile, useCurrentFrame } from "remotion";
const MyComp: React.FC = () => {
const frame = useCurrentFrame();
@@ -132,8 +132,8 @@ my-video/
β”œβ”€ src/
β”‚ β”œβ”€ style.css
β”‚ β”œβ”€ MyComp.tsx
-β”‚ β”œβ”€ Video.tsx
-β”‚ β”œβ”€ index.tsx
+β”‚ β”œβ”€ Root.tsx
+β”‚ β”œβ”€ index.ts
β”œβ”€ package.json
```
diff --git a/packages/docs/docs/jsx-support.md b/packages/docs/docs/jsx-support.md
index 51893d9209..adbc3e1db2 100644
--- a/packages/docs/docs/jsx-support.md
+++ b/packages/docs/docs/jsx-support.md
@@ -7,7 +7,7 @@ Since Remotion 1.3, you can opt out of Typescript and it's type checking advanta
## Opting out of Typescript
-You may import `.js` and `.jsx` files as normal. If you would like to completely move to JS, rename `index.tsx` and `Video.tsx` so they have a `.jsx` file extension. Remove types such as `React.FC` and `SpringConfig`.
+You may import `.js` and `.jsx` files as normal. If you would like to completely move to JS, rename `index.ts` and `Root.tsx` so they have a `.jsx` file extension. Remove types such as `React.FC` and `SpringConfig`.
## Upgrading
diff --git a/packages/docs/docs/miscellaneous/ts-aliases.md b/packages/docs/docs/miscellaneous/ts-aliases.md
index fe6d477edd..296a6a8cb4 100644
--- a/packages/docs/docs/miscellaneous/ts-aliases.md
+++ b/packages/docs/docs/miscellaneous/ts-aliases.md
@@ -14,7 +14,7 @@ Assuming you have a file:
β”œβ”€β”€ lib/
β”‚ β”œβ”€β”€ one.ts
β”‚ β”œβ”€β”€ two.ts
- β”œβ”€β”€ Video.tsx
+ β”œβ”€β”€ Root.tsx
└── index.ts
```
diff --git a/packages/docs/docs/player/player-integration.md b/packages/docs/docs/player/player-integration.md
index fa3ed97c42..e1ab70d092 100644
--- a/packages/docs/docs/player/player-integration.md
+++ b/packages/docs/docs/player/player-integration.md
@@ -49,14 +49,14 @@ yarn add remotion @remotion/cli @remotion/player
</TabItem>
</Tabs>
-Afterwards, create a subfolder for Remotion within your project and add three files: An index file, a `Video.tsx` file for your list of compositions, and a file with your composition. It could look like this:
+Afterwards, create a subfolder for Remotion within your project and add three files: An index file, a `Root.tsx` file for your list of compositions, and a file with your composition. It could look like this:
```diff
└── src/
+ β”œβ”€β”€ remotion/
-+ β”‚ β”œβ”€β”€ index.tsx
++ β”‚ β”œβ”€β”€ index.ts
+ β”‚ β”œβ”€β”€ MyComp.tsx
-+ β”‚ └── Video.tsx
++ β”‚ └── Root.tsx
└── app/
└── App.tsx
```
@@ -69,7 +69,7 @@ export const MyComp: React.FC<{ text: string }> = ({ text }) => {
};
```
-Your list of videos (`remotion/Video.tsx` in the example) could look like this:
+Your list of videos (`remotion/Root.tsx` in the example) could look like this:
```tsx twoslash
// @allowUmdGlobalAccess
@@ -78,7 +78,6 @@ export const MyComp = () => <></>;
// @filename: index.tsx
// ---cut---
-import React from "react";
import { Composition } from "remotion";
import { MyComp } from "./MyComp";
@@ -99,10 +98,10 @@ export const MyVideo = () => {
};
```
-Your index file (`remotion/index.tsx` in the example) could look like this:
+Your index file (`remotion/index.ts` in the example) could look like this:
```tsx twoslash
-// @filename: ./Video.tsx
+// @filename: ./Root.tsx
export const MyVideo: React.FC<{ text: string }> = () => <></>;
// ---cut---
@@ -121,14 +120,14 @@ Don't move these statements together into one file, as you might break hot reloa
You can open the Remotion Preview using the `npx remotion preview command`:
```bash
-npx remotion preview src/remotion/index.tsx
+npx remotion preview src/remotion/index.ts
```
We recommend adding a new script into your package.json for easy access:
```diff
"scripts": {
-+ "video": "remotion preview src/remotion/index.tsx"
++ "video": "remotion preview src/remotion/index.ts"
}
```
@@ -183,7 +182,7 @@ import path from "path";
import { bundle } from "@remotion/bundler";
const bundled = await bundle(
- path.join(process.cwd(), "src", "remotion", "index.tsx")
+ path.join(process.cwd(), "src", "remotion", "index.ts")
);
```
diff --git a/packages/docs/docs/register-root.md b/packages/docs/docs/register-root.md
index 6832386781..8cd86b2b98 100644
--- a/packages/docs/docs/register-root.md
+++ b/packages/docs/docs/register-root.md
@@ -15,7 +15,7 @@ title: registerRoot()
// @filename: ./Root.tsx
export const RemotionRoot = () => <></>;
-// @filename: index.tsx
+// @filename: index.ts
// ---cut---
import { registerRoot } from "remotion";
import { RemotionRoot } from "./Root";
@@ -31,7 +31,7 @@ export default () => <></>;
// @filename: MyOtherComponent.tsx
export default () => <></>;
-// @filename: index.tsx
+// @filename: index.ts
const Composition: React.FC<{
id: string;
fps: number;
@@ -70,15 +70,15 @@ export const RemotionRoot = () => {
In some cases, such as dynamically importing roots or loading WebAssembly, you might want to defer the loading of registerRoot(). If you are doing that, you need to tell Remotion to wait by using the [`delayRender()` / `continueRender()`](/docs/delay-render) pattern.
```tsx twoslash
-// @filename: ./Video.tsx
+// @filename: ./Root.tsx
export const RemotionRoot = () => <></>;
-// @filename: index.tsx
+// @filename: index.ts
const loadWebAssembly = () => Promise.resolve();
// ---cut---
import { continueRender, delayRender, registerRoot } from "remotion";
-import { RemotionRoot } from "./Video";
+import { RemotionRoot } from "./Root";
const wait = delayRender();
diff --git a/packages/docs/docs/skia/skia.md b/packages/docs/docs/skia/skia.md
index a882fd4323..3cb48ac12b 100644
--- a/packages/docs/docs/skia/skia.md
+++ b/packages/docs/docs/skia/skia.md
@@ -73,7 +73,7 @@ Config.Bundling.overrideWebpackConfig((currentConfiguration) => {
Next, you need to refactor the [entry point](/docs/terminology#entry-point) file to first load the Skia WebAssembly binary before calling registerRoot():
```ts twoslash title="src/index.ts"
-// @filename: ./Video.tsx
+// @filename: ./Root.tsx
export const RemotionRoot = () => <></>;
// @filename: index.tsx
@@ -83,7 +83,7 @@ import { registerRoot } from "remotion";
(async () => {
await LoadSkia();
- const { RemotionRoot } = await import("./Video");
+ const { RemotionRoot } = await import("./Root");
registerRoot(RemotionRoot);
})();
```
diff --git a/packages/docs/docs/staticfile.md b/packages/docs/docs/staticfile.md
index 73a251e95e..0549450bec 100644
--- a/packages/docs/docs/staticfile.md
+++ b/packages/docs/docs/staticfile.md
@@ -28,8 +28,8 @@ my-video/
β”‚ β”œβ”€ my-image.png
β”‚ β”œβ”€ font.woff2
β”œβ”€ src/
-β”‚ β”œβ”€ Video.tsx
-β”‚ β”œβ”€ index.tsx
+β”‚ β”œβ”€ Root.tsx
+β”‚ β”œβ”€ index.ts
β”œβ”€ package.json
```
diff --git a/packages/eslint-config/src/index.ts b/packages/eslint-config/src/index.ts
index d47be460ca..ad6830dd55 100644
--- a/packages/eslint-config/src/index.ts
+++ b/packages/eslint-config/src/index.ts
@@ -540,7 +540,7 @@ const getRules = (typescript: boolean) => {
"@typescript-eslint/no-var-requires": "off",
}
: {}),
- // In Video.tsx we encourage using fragment for just a single composition
+ // In Root.tsx we encourage using fragment for just a single composition
// since we intend to add more compositions later and you should then use a fragment.
"react/jsx-no-useless-fragment": "off",
// This is generally okay because on every frame, there will be a full rerender anyway!
diff --git a/packages/it-tests/src/rendering/rendering.test.ts b/packages/it-tests/src/rendering/rendering.test.ts
index 72cc053e4f..25f11ce609 100644
--- a/packages/it-tests/src/rendering/rendering.test.ts
+++ b/packages/it-tests/src/rendering/rendering.test.ts
@@ -328,7 +328,7 @@ test("Dynamic duration should work, and render from inside src/", async () => {
),
[
"render",
- "index.tsx",
+ "index.ts",
"dynamic-duration",
`--props`,
`{"duration": ${randomDuration}}`,