Skip to content

Latest commit

 

History

History

core

Folders and files

README.md

core

@music-library/core — platform-agnostic TypeScript shared by the web and mobile clients: the API client, player state machine, auth/session logic, favorites, storage abstraction, and the event bus.

It ships raw TypeScript source (no build step); consumers compile it themselves.

src/
  api.ts          typed API client for the backend
  auth/           auth/session core (React context-friendly)
  favorites/      favorites core
  player/         player state, queue, progress
  events.ts       event bus
  storage.ts      storage abstraction (localStorage / AsyncStorage adapters live in the consumers)
  index.ts        package entrypoint

Consumers

  • frontend imports it directly via file:../core plus Vite/tsconfig aliases that resolve @music-library/core straight to ../core/src.
  • mobile can't follow symlinks out of its project root (Metro), so it consumes a synced copy at mobile/packages/music-library-core. The copy is regenerated by npm run sync:core (also runs on postinstall) and is gitignored — edit only this package, never the copy.

Workflow

npm install
npx tsc -p tsconfig.json --noEmit   # typecheck

# after changes, refresh the mobile copy:
cd ../mobile && npm run sync:core

Validate consumers after cross-cutting changes: npm run typecheck in frontend/, npm run lint in mobile/.