Skip to content

Commit 6a87cce

Browse files
committed
Merge remote-tracking branch 'origin/main' into 5-0-license
# Conflicts: # .github/workflows/push.yml # LICENSE.md # bun.lock # packages/docs/docs/measure-spring.mdx # packages/docs/docs/schemas.mdx
2 parents 69a5df5 + cb5e0d5 commit 6a87cce

File tree

1,647 files changed

+70923
-26744
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,647 files changed

+70923
-26744
lines changed

.claude/commands/add-bug.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Add a new bug entry to `packages/bugs/api/[v].ts`.
2+
3+
The user will describe the bug and the affected version(s). Add the new entry at the top of the `bugs` array (after the opening bracket), following the existing format:
4+
5+
```ts
6+
{
7+
title: '<short title>',
8+
description: '<description with upgrade instruction>',
9+
link: 'https://remotion.dev/changelog',
10+
versions: ['<affected versions>'],
11+
},
12+
```
13+
14+
Rules:
15+
- The description should tell users which version to upgrade to.
16+
- The link should be `https://remotion.dev/changelog` unless the user provides a specific link.
17+
- Add the entry at the top of the array so the most recent bugs come first.

.claude/commands/checkout.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Checkout $0 and run `bun i` and `bun run build`.

.claude/commands/formatting.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Run `bun run stylecheck` until the exit code is 0.
2+
Don't bother with lambda-go errors.

.claude/commands/release.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- Kill any `turbo` processes that might be running with SIGKILL
2+
- Run `npm login` (I will manually do 2FA in the browser)
3+
- Use `op item get "Npmjs" --fields password --reveal` to get the password for NPM.
4+
- Use `op item get "Npmjs" --otp` to get a one-time password for 2FA.
5+
- Run `npm token create --name="PublishRemotionXXXXXX" --packages "remotion" --packages "create-video" --packages-and-scopes-permission read-write --bypass-2fa --scopes "@remotion" --otp=<otp>`. Replace XXXXXX with a random string so we have a unique name. Use `op item get "Npmjs" --otp` to get the OTP and pass it via `--otp=`. It will ask for a password, pipe in the password using `<<<`. The NPM token will be printed.
6+
- Run `bun i`
7+
- Run `bun run build`
8+
- Check `https://www.npmjs.com/package/remotion` to get the current version number
9+
- Run `bun set-version.ts <version>`, where <version> is the current version plus 1
10+
- Run `NPM_CONFIG_TOKEN=<token> bun run release` where <token> is the NPM token we just created

.claude/commands/update-stars.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Check on GitHub how many stars Remotion has.
2+
Always round down to the closest 1000, never round up.
3+
Update `packages/promo-pages/src/components/homepage/CommunityStatsItems.tsx`
4+
Update `packages/promo-pages/src/components/homepage/GitHubButton.tsx`.
5+
6+
Commit and push to main.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- Ensure we are on main branch and status is clean
2+
- Go to `package.json`
3+
- Find the `overrides` section and find `caniuse-lite`
4+
- Look on npm for the latest version of `caniuse-lite`
5+
- Update the version in the `overrides` section
6+
- Run `bun i` to install the new version
7+
- Git commit "Upgrade caniuse-lite to <version>" and push
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- Find the latest version of Mediabunny: `npm view mediabunny version`
2+
- Look in the root package.json and update the version of Mediabunny to that version.
3+
- Also upgrade @mediabunny/mp3-encoder to the same version.
4+
- Look in packages/template-\*/package.json and update the version of Mediabunny to the desired version.
5+
- Update `packages/cli/src/extra-packages.ts` with the new Mediabunny version.
6+
- Update `packages/studio-shared/src/package-info.ts` with the new Mediabunny version in `extraPackages`.
7+
- Update `packages/docs/docs/mediabunny/version.mdx` compatiblity table. To find the next version this upgrade is going to be applied, look in the root package.json for the version and increment the patch version by one
8+
- Run `bun i` in the end.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Add a new CLI option
2+
3+
How to convert a hardcoded CLI flag into a proper `AnyRemotionOption`, or add a brand new one.
4+
5+
## 1. Create the option definition
6+
7+
Create `packages/renderer/src/options/<name>.tsx`:
8+
9+
```tsx
10+
import type {AnyRemotionOption} from './option';
11+
12+
let myValue = false; // module-level default state
13+
14+
const cliFlag = 'my-flag' as const;
15+
16+
export const myFlagOption = {
17+
name: 'Human-readable Name',
18+
cliFlag,
19+
description: () => <>Description shown in docs.</>,
20+
ssrName: null, // or 'myFlag' if used in SSR APIs
21+
docLink: 'https://www.remotion.dev/docs/config#setmyflagenabled',
22+
type: false as boolean, // default value, also sets the TypeScript type
23+
getValue: ({commandLine}) => {
24+
if (commandLine[cliFlag] !== undefined) {
25+
return {value: commandLine[cliFlag] as boolean, source: 'cli'};
26+
}
27+
return {value: myValue, source: 'config'};
28+
},
29+
setConfig(value) {
30+
myValue = value;
31+
},
32+
} satisfies AnyRemotionOption<boolean>;
33+
```
34+
35+
The type in `AnyRemotionOption<T>` and `type: <default> as T` determines the option's value type. Use `boolean`, `string | null`, `number | null`, etc.
36+
37+
For negating flags (like `--disable-ask-ai``askAIEnabled = false`), handle the inversion in `getValue`.
38+
39+
## 2. Register in options index
40+
41+
**`packages/renderer/src/options/index.tsx`**:
42+
43+
- Add the import (keep alphabetical within the import block)
44+
- Add the option to the `allOptions` object
45+
46+
This makes it available as `BrowserSafeApis.options.myFlagOption` throughout the codebase.
47+
48+
## 3. Update CLI parsed flags
49+
50+
**`packages/cli/src/parsed-cli.ts`**:
51+
52+
- For boolean flags, add `BrowserSafeApis.options.myFlagOption.cliFlag` to the `BooleanFlags` array
53+
- For non-boolean flags, no entry needed here (minimist handles them as strings/numbers automatically)
54+
55+
**`packages/cli/src/parse-command-line.ts`**:
56+
57+
- Add to the destructured `BrowserSafeApis.options`
58+
- In the `CommandLineOptions` type, add: `[myFlagOption.cliFlag]: TypeOfOption<typeof myFlagOption>;`
59+
60+
## 4. Use the option where needed
61+
62+
Instead of reading `parsedCli['my-flag']` directly, resolve via:
63+
64+
```ts
65+
const myFlag = myFlagOption.getValue({commandLine: parsedCli}).value;
66+
```
67+
68+
For Studio options, this is typically in `packages/cli/src/studio.ts`. For render options, in the relevant render command file.
69+
70+
## 5. Add to Config
71+
72+
**`packages/cli/src/config/index.ts`**:
73+
74+
- Add to the destructured `BrowserSafeApis.options`
75+
- Add the setter signature to the `FlatConfig` type (either in the `RemotionConfigObject` global interface or the `FlatConfig` intersection)
76+
- Add the implementation to the `Config` object: `setMyFlagEnabled: myFlagOption.setConfig`
77+
78+
## 6. Update docs
79+
80+
In the relevant CLI command page:
81+
82+
- Add a `### \`--my-flag\`` section
83+
- Use `<Options id="my-flag" />` to pull the description from the option definition automatically
84+
- The `id` matches the option's `cliFlag` value
85+
86+
**`packages/docs/docs/config.mdx`**:
87+
88+
- Add a `## \`setMyFlagEnabled()\`` section with:
89+
- `<Options id="my-flag" />` for the description
90+
- A twoslash config example
91+
- A note that the CLI flag takes precedence
92+
93+
Follow the pattern of nearby entries (e.g., `setAskAIEnabled`, `setEnableCrossSiteIsolation`).
94+
95+
## 7. Build and verify
96+
97+
```sh
98+
cd packages/renderer && bun run make
99+
cd packages/cli && bun run make
100+
```
101+
102+
## Reference files
103+
104+
- Option type definition: `packages/renderer/src/options/option.ts`
105+
- Good example to copy: `packages/renderer/src/options/ask-ai.tsx` (boolean, studio-only)
106+
- Options index: `packages/renderer/src/options/index.tsx`
107+
- CLI flag registration: `packages/cli/src/parsed-cli.ts`
108+
- CLI type definitions: `packages/cli/src/parse-command-line.ts`
109+
- Config registration: `packages/cli/src/config/index.ts`

.claude/skills/add-expert/SKILL.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: add-expert
3+
description: Add a new expert to the Remotion experts page
4+
---
5+
6+
## Steps
7+
8+
1. **Add the expert's photo** to both:
9+
- `packages/docs/static/img/freelancers/<firstname>.png`
10+
- `packages/promo-pages/public/img/freelancers/<firstname>.png`
11+
12+
The image should be a square headshot (PNG format). Both paths must have the same file.
13+
14+
2. **Add an entry** to the `experts` array in `packages/promo-pages/src/components/experts/experts-data.tsx`:
15+
16+
```tsx
17+
{
18+
slug: 'firstname-lastname',
19+
name: 'First Last',
20+
image: '/img/freelancers/<firstname>.png',
21+
website: 'https://example.com' | null,
22+
x: 'twitter_handle' | null,
23+
github: 'github_username' | null,
24+
linkedin: 'in/linkedin-slug/' | null,
25+
email: 'email@example.com' | null,
26+
videocall: 'https://cal.com/...' | null,
27+
since: new Date('YYYY-MM-DD').getTime(),
28+
description: (
29+
<div>
30+
A short description of the expert's work and specialties.
31+
Links to projects can be included with <a> tags.
32+
</div>
33+
),
34+
},
35+
```
36+
37+
- `since` should be set to today's date
38+
- `slug` must be lowercase, hyphenated version of the name
39+
- Set unused social fields to `null`
40+
- The entry goes at the end of the `experts` array (before the closing `]`)
41+
42+
3. **Render the expert card** by running in `packages/docs`:
43+
44+
```
45+
bun render-cards
46+
```
47+
48+
This generates `packages/docs/static/generated/experts-<slug>.png`. Verify it says "Rendered experts-\<slug\>" (not "Existed").
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Add a new Remotion package
2+
3+
## Steps
4+
5+
1. **Create `packages/<name>/`** with these files:
6+
- `package.json` — copy from `@remotion/light-leaks` as template; update name, description, homepage, dependencies
7+
- `tsconfig.json` — extends `../tsconfig.settings.json`, uses tsgo with `emitDeclarationOnly: true`, `outDir: "dist"`, `module: "es2020"`, `moduleResolution: "bundler"`, `target: "ES2022"`
8+
- `src/index.ts` — exports
9+
- `bundle.ts` — Bun build script, externalize `react`, `remotion`, `remotion/no-react`, `react/jsx-runtime`, `react/jsx-dev-runtime`, `react-dom`
10+
- `eslint.config.mjs` — use `remotionFlatConfig({react: true})` if React, `{react: false}` otherwise
11+
- `.npmignore` — copy from `@remotion/light-leaks`
12+
- `README.md` — package name, description, install command, link to docs
13+
14+
2. **Register in monorepo:**
15+
- `tsconfig.json` (root) — add `{"path": "./packages/<name>"}` to references
16+
- `packages/cli/src/list-of-remotion-packages.ts` — add `'@remotion/<name>'`
17+
- `packages/create-video/src/list-of-remotion-packages.ts` — add `'@remotion/<name>'`
18+
- `packages/studio-shared/src/package-info.ts` — add to `packages`, `descriptions`, `installableMap`, `apiDocs`
19+
20+
3. **Documentation (`packages/docs/docs/<name>/`):**
21+
- Add `"@remotion/<name>": "workspace:*"` to `packages/docs/package.json` dependencies (needed for twoslash snippets)
22+
- `index.mdx` — install tabs, table of contents, license
23+
- `table-of-contents.tsx` — TOCItem grid linking to component/function pages
24+
- Individual component/function `.mdx` pages
25+
- Edit `packages/docs/sidebars.ts` — add category
26+
- Edit `packages/docs/components/TableOfContents/api.tsx` — import table of contents and add section
27+
28+
See the `writing-docs` skill for details on writing documentation.
29+
30+
4. **Example usage:**
31+
- Add `"@remotion/<name>": "workspace:*"` to `packages/example/package.json`
32+
- Create `packages/example/src/<Name>/index.tsx`
33+
- Register `<Composition>` in `packages/example/src/Root.tsx`
34+
- Add `{"path": "../<name>"}` to `packages/example/tsconfig.json` references
35+
36+
5. **Run `bun i`** to install dependencies
37+
38+
6. **Build:** `cd packages/<name> && bun run make`
39+
40+
## Version
41+
42+
Use the current version from `packages/core/src/version.ts`.
43+
For the documentation version, increment the patch version by 1 as it will only be released with the next Remotion release.
44+
45+
## Patterns
46+
47+
- Use `"workspace:*"` for internal dependencies
48+
- Use `"catalog:"` for shared external dependency versions
49+
- The `make` script is: `tsgo && bun --env-file=../.env.bundle bundle.ts`
50+
- Add `"type": "module"` to `package.json`
51+
- Add `"@typescript/native-preview": "catalog:"` to devDependencies
52+
- Types/main point to `dist/index.d.ts` and `dist/index.js` (not `dist/cjs/`)
53+
- Packages with React components need `peerDependencies` for `react` and `react-dom`

0 commit comments

Comments
 (0)