Skip to content

🎥 Make videos programmatically with React

@remotion/brand: Add React Scan capture

Jonny Burger4a09ee2fa31b
diff --git a/.agents/skills/react-scan/SKILL.md b/.agents/skills/react-scan/SKILL.md
index 4bf4e17e7a..b298272baa 100644
--- a/.agents/skills/react-scan/SKILL.md
+++ b/.agents/skills/react-scan/SKILL.md
@@ -16,6 +16,12 @@ Start from the repository root:
bun run react-scan:capture
```
+For the Brand Studio, run:
+
+```sh
+bun run react-scan:capture:brand
+```
+
Wait for Studio to finish building, open the printed Studio URL with the browser,
and let the page settle. The React Scan WebMCP tools are only registered in this
development capture mode.
diff --git a/package.json b/package.json
index edd643a3d2..9b2db85898 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,7 @@
"watchthree": "turbo watch make --experimental-write-cache --filter='@remotion/three'",
"release": "bun publish.ts && turbo run publishprivate --concurrency=1 && git push --tags && git push",
"react-scan:capture": "bun packages/.monorepo/react-scan/capture.ts",
+ "react-scan:capture:brand": "bun packages/.monorepo/react-scan/capture.ts --package brand",
"studio:cpu-profile": "bun packages/.monorepo/cpu-profile/capture.ts",
"publishtemplates": "cd packages/it-tests && bun src/templates/publish.ts",
"playground": "bun packages/skills-evals/src/playground.ts",
diff --git a/packages/.monorepo/react-scan/capture.ts b/packages/.monorepo/react-scan/capture.ts
index 6407c733c7..b1b42bb11b 100644
--- a/packages/.monorepo/react-scan/capture.ts
+++ b/packages/.monorepo/react-scan/capture.ts
@@ -3,22 +3,33 @@ import path from 'node:path';
const repositoryRoot = path.resolve(import.meta.dir, '../../..');
const clientEntryPoint = path.join(import.meta.dir, 'client.ts');
+const getPackageName = () => {
+ const packageArgumentIndex = process.argv.indexOf('--package');
+ const packageName =
+ packageArgumentIndex === -1
+ ? 'example'
+ : process.argv[packageArgumentIndex + 1];
+
+ if (packageName !== 'example' && packageName !== 'brand') {
+ throw new Error(
+ `--package must be either "example" or "brand", got ${JSON.stringify(packageName)}`,
+ );
+ }
+
+ return packageName;
+};
+
const startReactScanStudio = async () => {
if (process.argv.includes('--help')) {
- console.log('bun run react-scan:capture');
+ console.log('bun run react-scan:capture [-- --package <example|brand>]');
return;
}
+ const packageName = getPackageName();
+
console.log('Building the React Scan-enabled Studio entry...');
const build = Bun.spawn(
- [
- 'bunx',
- 'turbo',
- 'run',
- 'make',
- '--filter=@remotion/studio-shared',
- '--filter=@remotion/bundler',
- ],
+ ['bunx', 'turbo', 'run', 'make', `--filter=@remotion/${packageName}...`],
{
cwd: repositoryRoot,
stderr: 'inherit',
@@ -29,9 +40,11 @@ const startReactScanStudio = async () => {
throw new Error('Could not build the Studio bundler for React Scan');
}
- console.log('Starting Studio with React Scan WebMCP tools enabled...');
+ console.log(
+ `Starting ${packageName} Studio with React Scan WebMCP tools enabled...`,
+ );
const studio = Bun.spawn(['bun', 'run', 'dev', '--', '--force-new'], {
- cwd: path.join(repositoryRoot, 'packages', 'example'),
+ cwd: path.join(repositoryRoot, 'packages', packageName),
env: {
...process.env,
REMOTION_REACT_SCAN_ENTRY_POINT: clientEntryPoint,