Skip to content

🎥 Make videos programmatically with React

make entry point index.ts and rename Video.tsx to RemotionRoot

Jonny Burger79f01d6567fd
diff --git a/packages/cli/src/entry-point.ts b/packages/cli/src/entry-point.ts
index 951ef806a8..c84c323a87 100644
--- a/packages/cli/src/entry-point.ts
+++ b/packages/cli/src/entry-point.ts
@@ -4,12 +4,12 @@ import {ConfigInternals} from './config';
import {Log} from './log';
const candidates = [
+ path.join('src', 'index.ts'),
+ path.join('src', 'index.tsx'),
+ path.join('src', 'index.js'),
path.join('remotion', 'index.tsx'),
path.join('remotion', 'index.ts'),
path.join('remotion', 'index.js'),
- path.join('src', 'index.tsx'),
- path.join('src', 'index.ts'),
- path.join('src', 'index.js'),
];
const findCommonPath = (remotionRoot: string) => {
diff --git a/packages/create-video/src/test/validate-templates.test.ts b/packages/create-video/src/test/validate-templates.test.ts
index ed055f6b41..8700ec1be8 100644
--- a/packages/create-video/src/test/validate-templates.test.ts
+++ b/packages/create-video/src/test/validate-templates.test.ts
@@ -16,6 +16,15 @@ for (const template of FEATURED_TEMPLATES) {
});
expect(res.statusCode).toBe(200);
const body = JSON.parse(res.body);
+
+ if (
+ !template.shortName.includes('Remix') &&
+ !template.shortName.includes('Still')
+ ) {
+ expect(body.scripts.build).toMatch(/render/);
+ expect(body.scripts.build).not.toContain('index');
+ }
+
expect(body.dependencies.remotion).toMatch(/^\^3/);
expect(body.dependencies['@remotion/cli']).toMatch(/^\^3/);
expect(body.dependencies.react).toMatch(/^\^?18/);
diff --git a/packages/docs/docs/brownfield-installation.md b/packages/docs/docs/brownfield-installation.md
index d4bd73f671..947a2f3149 100644
--- a/packages/docs/docs/brownfield-installation.md
+++ b/packages/docs/docs/brownfield-installation.md
@@ -67,7 +67,7 @@ import React from "react";
import { Composition } from "remotion";
import { MyComposition } from "./Composition";
-export const RemotionVideo: React.FC = () => {
+export const RemotionRoot: React.FC = () => {
return (
<>
<Composition
@@ -93,7 +93,7 @@ import React from "react";
import { Composition } from "remotion";
import { MyComposition } from "./Composition";
-export const RemotionVideo: React.FC = () => {
+export const RemotionRoot: React.FC = () => {
return (
<>
<Composition
@@ -110,9 +110,9 @@ export const RemotionVideo: React.FC = () => {
// @filename: index.ts
// ---cut---
import { registerRoot } from "remotion";
-import { RemotionVideo } from "./Video";
+import { RemotionRoot } from "./Video";
-registerRoot(RemotionVideo);
+registerRoot(RemotionRoot);
```
The file that calls [`registerRoot()`](/docs/register-root) is now your Remotion **entrypoint**.
diff --git a/packages/docs/docs/register-root.md b/packages/docs/docs/register-root.md
index b6a6c92473..6832386781 100644
--- a/packages/docs/docs/register-root.md
+++ b/packages/docs/docs/register-root.md
@@ -43,7 +43,7 @@ const Composition: React.FC<{
import MyComponent from "./MyComponent";
import MyOtherComponent from "./MyOtherComponent";
-export const RemotionVideo = () => {
+export const RemotionRoot = () => {
return (
<>
<Composition
@@ -71,19 +71,19 @@ In some cases, such as dynamically importing roots or loading WebAssembly, you m
```tsx twoslash
// @filename: ./Video.tsx
-export const RemotionVideo = () => <></>;
+export const RemotionRoot = () => <></>;
// @filename: index.tsx
const loadWebAssembly = () => Promise.resolve();
// ---cut---
import { continueRender, delayRender, registerRoot } from "remotion";
-import { RemotionVideo } from "./Video";
+import { RemotionRoot } from "./Video";
const wait = delayRender();
loadWebAssembly().then(() => {
- registerRoot(RemotionVideo);
+ registerRoot(RemotionRoot);
continueRender(wait);
});
```
diff --git a/packages/docs/docs/the-fundamentals.md b/packages/docs/docs/the-fundamentals.md
index bcc87cbbe6..a58f6c6df3 100644
--- a/packages/docs/docs/the-fundamentals.md
+++ b/packages/docs/docs/the-fundamentals.md
@@ -79,7 +79,7 @@ import { Composition } from "remotion";
// @include: example-MyComposition
// ---cut---
-export const RemotionVideo: React.FC = () => {
+export const RemotionRoot: React.FC = () => {
return (
<>
<Composition