Skip to content

machina.js v6: TypeScript rewrite with monorepo structure#175

Merged
ifandelse merged 7 commits intomasterfrom
machina-v6
Feb 23, 2026
Merged

machina.js v6: TypeScript rewrite with monorepo structure#175
ifandelse merged 7 commits intomasterfrom
machina-v6

Conversation

@ifandelse
Copy link
Owner

@ifandelse ifandelse commented Feb 22, 2026

Summary

Complete rewrite of machina.js for v6. The JavaScript source (src/, lib/, spec/) has been replaced with a TypeScript implementation under a pnpm monorepo structure.

What changed:

  • Core library (packages/machina/): Full TypeScript rewrite of BehavioralFsm, Fsm, emitter, and utilities. New typed API surface with createFsm and createBehavioralFsm factory functions alongside class exports. Comprehensive test suite (~4K lines across 3 test files).
  • Documentation (packages/docs/): Astro/Starlight docs site covering concepts, guides, migration (v5→v6), and example walkthroughs. GitHub Actions workflow for deployment.
  • Example apps (examples/): Five demo apps — connectivity monitor, dungeon critters game, shopping cart, traffic intersection, and a React checkout flow — each with their own FSM configs, tests, and Vite builds.
  • Infrastructure: Moved to pnpm workspaces + Turborepo. Old v5 code archived. Root-level build configs (webpack, karma, gulp) removed. New tooling: tsup for library builds, Jest for testing, ESLint + Prettier for formatting.

What was removed:

  • Pre-v6 source, specs, build tooling, Bower config, and example apps moved to archive or deleted.
  • Old package-lock.json replaced by pnpm-lock.yaml.

Test Plan

pnpm install && pnpm test

Pre-submission Checks

General Checks

  • ✅ New environment variables
  • ✅ Dead code
  • ✅ Leftover debugging
  • ✅ Breaking interface changes
  • ✅ Large binary/asset additions

React & Frontend Checks

  • 🤷 Missing data-cy — acceptable for demo
  • ✅ One public component per file
  • ✅ No direct component tests
  • ✅ BEM class naming
  • ✅ Missing key on dynamic lists
  • ✅ Direct DOM manipulation
  • ✅ Derived state anti-pattern
  • 🤷 Hardcoded strings — acceptable for demo
  • 🤷 Missing error boundaries — acceptable for demo
  • ✅ Prop drilling
  • ✅ Non-memoized context values
  • ✅ useEffect missing cleanup

Unit Test Checks

  • ✅ Critical Rule 1
  • ✅ Critical Rule 2
  • ✅ No testing style hooks
  • ✅ No testing barrel exports
  • ✅ Missing export default {}

@ifandelse ifandelse marked this pull request as ready for review February 23, 2026 01:10
@ifandelse ifandelse merged commit 82ae438 into master Feb 23, 2026
1 of 2 checks passed
@ifandelse ifandelse deleted the machina-v6 branch February 23, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant