On this page

Contributing

mise installs Bun and Node at the versions in mise.toml. Run mise install, then install the dependencies:

sh
bun install --frozen-lockfile

Run every check before you open a pull request:

sh
bun run check

It runs these scripts:

ScriptWhat it does
bun run lintoxlint with warnings as errors, and oxfmt --check.
bun run typechecktsc --noEmit over the library, its tests and the site.
bun run testvitest run.
bun run buildtsc writes the declarations to dist.
bun run install:browsersInstalls the Chromium that the site tests drive.
bun run test:siteBuilds the site and tests it in Chromium (see below).

bun run fix applies the safe lint fixes and formats code and Markdown.

Site

site/ is the documentation site, built with folio. folio renders each page of the manual in docs/ to a static page, and mounts a demo where the page says <!-- island NAME -->. Each demo runs twice, once with solid-motion and once with motion/react, with the same controls. docs/index.md is the home page, and its hero island is site/src/pages/hero.tsx. The bench island on docs/compare.md is site/src/pages/bench.tsx; it is not a demo and has no probe, and site/tests/bench.spec.ts runs it.

sh
bun run --filter solid-motion-site dev    # dev server on localhost:5173
bun run build:site                        # static files in site/dist

The tests drive every demo in Chromium. Install the browser first, then run them:

sh
bun run install:browsers
bun run test:site

A demo is three files in site/src/demos: <name>.config.ts for its parameters, <name>.tsx for the solid-motion version and its code, and <name>.react.tsx for the motion/react twin. Register it in site/src/islands.ts, put a <!-- island <name> --> marker where it belongs on its manual page, and add a probe for it in site/tests/probes.ts. A probe says where the demo ends and which control changes the result.

Every demo has both sides, and the tests drive both with the same probe. A demo of something solid-motion cannot do yet lands with the feature.

Tests

Tests run on jsdom. tests/clock.ts fakes the clock and the frame loop, so an animation's progress depends only on how far the test advances the clock. Use useFakeClock() in a suite and await advance(ms) to move time forward.

jsdom does no layout. A layout test gives each element a box, as tests/layout.test.tsx does.

A test drives the behavior through motion.* or one of the create* functions, and checks what the element looks like. It does not mock motion-dom.

Docs

The manual is in docs/. Each page has an example. Run an example before you change the text around it.

The manual is for people who use the package. Notes on how the code works stay in this folder: Architecture covers the source files and their shared state, and Profiling covers bun run perf.

bun run fix formats the Markdown.

Releases

Maintainers publish with a tag. See Releasing. A push to master that changes the site deploys it. See Deploying the site.