π₯ 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.mdindex 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.tsxexport 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.tsximport 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.mdindex 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.mdindex 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`.## Upgradingdiff --git a/packages/docs/docs/miscellaneous/ts-aliases.md b/packages/docs/docs/miscellaneous/ts-aliases.mdindex 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.mdindex 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.tsxexport 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 reloaYou 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.mdindex 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.tsxexport 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.tsxexport default () => <></>;-// @filename: index.tsx+// @filename: index.tsconst 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.tsxexport const RemotionRoot = () => <></>;-// @filename: index.tsx+// @filename: index.tsconst 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.mdindex 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.tsxexport 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.mdindex 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.tsindex 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.tsindex 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}}`,