Skip to documentation
CranberryClock.Ideas / Systems / Design

INDEPENDENT TOOL / v0.1.0

LedgerIntegration guide

Install Ledger, connect it to your project, and understand the integration boundaries.

Start with the package archive.

Download Ledger v0.1.0 ↓, then follow the installation instructions below. Commands that pack source files run from the public repository checkout.

Install

Packages are distributed as source/archive, not published to npm.

bash
npm pack ./dist/packages/ledger
npm install /path/to/cranberry-forge-ledger-0.1.0.tgz

Requires Node 22+ for Node examples, or a modern browser supporting structuredClone.

Example

javascript
import { Ledger } from "@cranberry-forge/ledger";
const stats = new Ledger({ base: { attack: 50, speed: 3 }, rounding: 2 });
stats.setModifier({
  id: "blade:attack",
  source: "blade",
  stat: "attack",
  kind: "flat",
  value: 10,
});
console.log(stats.result.values.attack); // 60
stats.removeSource("blade"); // attack returns to 50

Step-by-step tutorial · Runnable Node example

View versioned source on GitHub ↗