How verekia/manapotion works
Project type and purpose
• This is an open-source, monorepo toolkit (“Mana Potion”) for JavaScript game development. It provides a set of low-level utilities (input listeners, main loop, virtual joysticks, browser helpers, Tailwind theme) plus framework-specific adapters for React, Vue, Svelte, and vanilla JS.
File structure
• Top-level:
• Configuration & CI: Dockerfile, .github/workflows, nginx.conf, deploy.sh, lerna.json
• Packages: packages/core, packages/react, packages/vue, packages/svelte, packages/vanilla
• Examples: examples/react, examples/vue, examples/svelte, examples/vanilla
• Website: docs/demo site under website
• Each packages/* contains source code for a distributable npm package.
• packages/core is the foundational library (listeners, stores, main loop, joystick).
• Other packages import core and add framework-specific bindings (hooks/components/stores).
• Examples import the corresponding framework package to demonstrate usage.
• CI/CD files govern testing, linting, building, publishing to npm, and deploying the website.
Key README insights
• Core features: Listeners (reactive and non-reactive stores), main loop, virtual joysticks, browser API helpers, Tailwind media queries.
• Adapters (@manapotion/react, vue, svelte, vanilla) wrap core features in idiomatic APIs (hooks, components, stores).
• Examples and demo URLs showcase each integration.
• Versioning via Lerna, breaking changes before 1.0.
a. Main components
• Core Library (packages/core)
• Framework Adapters (packages/react, packages/vue, packages/svelte, packages/vanilla)
• Example Apps (examples/*)
• Documentation/Demo Website (website)
• External Services: GitHub (SCM & CI), npm Registry (package hosting), Docker Registry (optional), Discord (community)
b. Relationships & interactions
• Core Library → publishes to npm → consumed by Framework Adapters
• Framework Adapters → publish to npm → consumed by Example Apps & user projects
• Example Apps → import adapters → render game UI & interactive demos
• Website → uses built artifacts & examples → deployed via deploy.sh & nginx
• CI Pipeline → on push publishes packages & deploys website
c. Architectural patterns
• Monorepo managed by Lerna: single repo, multiple packages, shared config
• Layered modular design: core utilities at bottom, adapter wrappers above, consumer applications at top
• CI/CD pipeline orchestrates build, test, publish, deploy
d. Technologies & frameworks
• TypeScript, Vite for bundling examples & website
• Zustand for reactive stores
• Tailwind CSS for styling and media‐query helpers
• Docker & nginx for containerized website deployment
• GitHub Actions for automation
Essential elements to capture
• Lerna monorepo root and shared config (.eslint, tsconfig, prettier)
• Core module exporting listeners, loop, joystick, helpers
• Framework adapters importing core and exporting hooks/components
• Example source directories demonstrating adapter usage
• Documentation/demo website pulling from built examples & hosting live demos
• CI pipeline steps and external services (GitHub Actions → npm → Docker Registry → nginx)