Skip to content

@actdim/msgmesh-store Setup, Build & Workflow ​

1. Prerequisites & Installation ​

  • Node.js: a release with global crypto, structuredClone and queueMicrotask (Node 19 or later; current LTS recommended).
  • Package manager: pnpm.
  • TypeScript: ^5.9.3 (dev dependency).

Install as a consumer:

bash
pnpm add @actdim/msgmesh-store @actdim/msgmesh @actdim/utico rxjs
pnpm add @actdim/livestruct # optional peer

2. Scripts ​

CommandActionDescription
pnpm run testnpx vitest --config=vitest.node.config.ts --no-cacheRuns the Node test suite in tests/ once.
pnpm run test:wnpx vitest --config=vitest.node.config.ts --watchRuns the test suite in watch mode.
pnpm run buildtsc -b tsconfig.json && vite buildTypechecks, then builds ESM bundles and .d.ts files into dist/ for the ., ./cdc, ./bridge, ./worker entries.
pnpm run typechecktsc -b tsconfig.jsonType checks without bundling.
pnpm run formatprettier --write .Formats the package.
pnpm run format:checkprettier --check .Verifies formatting.
pnpm run docs:devvitepress dev docsServes the documentation site locally.
pnpm run docs:buildvitepress build docsBuilds the documentation site.
pnpm run docs:previewvitepress preview docsPreviews the built site.

3. Test Suite (tests/) ​

The tests run in Node against in-memory LiveStruct stores (forceMemory: true) and in-memory ports, so they need no browser:

FileCovers
bridge.test.tsCommand translation, origin labeling, echo suppression, ordering, errors, disposal.
cdc.test.tstoStoreCdcObservable, filters, publishCdcToBus, subscribeCdc, createCdcBridge, secondary channels.
worker.test.tsHandshake, lazy factories, commands, queries, CDC streaming, timeouts, close and reconnect, batching.
ledger.test.tsMutationLedger semantics and capacity eviction.
keyedQueue.test.tsKeyedSerialQueue ordering, isolation and drain().
applyMutation.test.tsnormalizeCommand, resolveMutationTarget, applyStoreCommand.
types.test.tsCompile-time constraints of the public API.

Tests are hermetic: they await whenIdle(), CDC promises or microtasks rather than fixed timers.

4. Development Inside the Mempart Monorepo ​

  • The package lives at src/packages/msgmesh-store and is a Git submodule of the mempart repository (https://github.com/actdim/msgmesh-store.git).
  • It is a member of the pnpm workspace (src/pnpm-workspace.yaml includes packages/*). With link-workspace-packages=true in src/.npmrc, the dev dependencies @actdim/livestruct, @actdim/msgmesh and @actdim/utico resolve to the sibling packages in src/packages/, so changes there are picked up without publishing.
  • Run package scripts from the package folder, or from src/ with a filter, for example pnpm --filter @actdim/msgmesh-store test.
  • Versions are synchronized monorepo-wide; do not bump this package's version on its own (the root pnpm run version:sync <version> script updates every package together).
  • When @actdim/livestruct changes its engine or collection shape, run this package's typecheck and test to confirm the structural targets still match.

Released under the MIT License.