mise installs Bun and Node at the versions in
mise.toml. Run mise install, then install the dependencies:
bun install --frozen-lockfileRun every check before you open a pull request:
bun run checkIt runs these scripts:
| Script | What it does |
|---|---|
bun run lint | oxlint with warnings as errors, and oxfmt --check. |
bun run typecheck | tsc --noEmit over the library, its tests and the site. |
bun run test | vitest run. |
bun run build | tsc writes the declarations to dist. |
bun run install:browsers | Installs the Chromium that the site tests drive. |
bun run test:site | Builds 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.
bun run --filter solid-motion-site dev # dev server on localhost:5173
bun run build:site # static files in site/distThe tests drive every demo in Chromium. Install the browser first, then run them:
bun run install:browsers
bun run test:siteA 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.