Skip to Content
Contributing

Contributing

To contribute, clone the react-x-embed repository and run the Next.js test app to start an app locally that uses the react-x-embed package. Any changes you make to the package will be reflected in the test app.

pnpm install pnpm dev --filter=next-app...

Running the tests

pnpm test --filter=react-x-embed

Tests run against captured syndication payloads in packages/react-x-embed/test/fixtures, so they need no network access and don’t depend on a post still existing.

Each fixture pins a distinct response shape the renderer has to survive — multi-photo grids, video with several renditions, mixed video and photo, quoted posts with and without their own media, truncated note posts, and link cards. Alongside them are *.x-embed.html, *.x-embed.css and *.x-embed.geometry.json: X’s own rendered markup, shipped stylesheet rules, and computed box geometry for the same posts, captured from platform.twitter.com.

If you change layout, measure against those captures rather than adjusting by eye. The aspect-ratio assertions in the test suite come from them directly.

Adding a fixture

If you hit a post shape that isn’t covered, add it. Fetch the syndication response, save it as test/fixtures/<name>.json, and register it in test/fixtures/index.ts with a short note on the render path it exercises. A fixture with no distinct covers reason is just slower CI.

Before opening a pull request

pnpm lint --filter=react-x-embed pnpm build --filter=react-x-embed

The syndication API is undocumented and changes without notice, so changes that touch payload handling should degrade rather than throw. isValidTweet exists because every past shape change surfaced as a crash inside rendering — treat a new required field as a bug, not a fix.

Once you’re done, submit a pull request . It’s recommended to open an issue  first before making any major changes, so the approach can be discussed before you spend time on it.

Upstream

This project is a fork of vercel/react-tweet . If your change is a general fix that would benefit that project too, consider sending it there as well — note that upstream requires verified commits .

Last updated on