Development
Build the package and docs from one workspace.
Use Node 24 or newer and npm. One lockfile installs the library and the documentation app.
bun install --frozen-lockfile
npm run build
npm run typecheck
npm run test
npm run coverage
npm run test:matrix
npm run size
npm run pack:check
npm run test:browser
npm run devType checking uses tsrs, a Rust port of the TypeScript 7 compiler that reports the same diagnostics as tsc. tsrs ships binaries for macOS on Apple Silicon and Linux (x64/arm64) only. On Windows or an Intel Mac, use the tsc fallbacks instead:
npm run typecheck:tsc # library type check with the regular TypeScript compiler
npm run docs:check:tsc # docs and snippet type check with tscThe library build (tsup) never used tsc, so npm run build, tests, and coverage work everywhere. npm run docs:build runs tsrs before next build; on those platforms run npm run docs:check:tsc, then npm --workspace @bloxwap/haptic-docs exec -- next build.
The docs run at http://localhost:3905. bun run dev invokes the same development script; npm remains the lockfile authority.
The library is consolidated in packages/haptic/src: public exports in index.ts, the React target in haptic.tsx, platform routing in platform.ts, and the imperative vibration helpers in trigger.ts. Tests and package verification belong to that package. Next.js, Fumadocs, branding, and interactive examples belong to private apps/docs.
The docs use package-name imports, so a build checks the same public interface consumers receive.
NEXT_PUBLIC_BASE_PATH=/haptic npm run docs:build
npm run docs:check
npm run docs:previewThe preview serves the static export, including its configured base path. Coverage gates runtime source; browser checks and physical-device observations supply separate evidence for interaction and hardware.
GitHub Actions run on self-hosted Apple silicon Mac minis except the npm publish job in publish_npm.yml, which uses GitHub-hosted ubuntu-24.04 for npm trusted publishing and provenance behind the npm-release environment gate. On the minis, install Playwright browsers with npx playwright install (not --with-deps). The Ubuntu publish job uses npx playwright install --with-deps chromium. Runner tools and labels are listed in docs/ci-runners.md.