/rg-stats

A TypeScript library for calculating various rhythm game stats.

Primary LanguageTypeScript

Rhythm Game Stats Library

Documentation Status

This is a TypeScript library for calculating rhythm game stats.

You can install it with your preferred NodeJS package manager:

# npm
npm install rg-stats

# yarn
yarn add rg-stats

# pnpm
pnpm add rg-stats

API

Documentation is available on Read The Docs.

Contributing to the library

This is a mini-monorepo. The TS library is in library/, and the documentation is in documentation/

Library

We use PNPM as our package manager. Use pnpm install inside library/ to install dependencies.

Build Script

We use TypeScript. This means you have to run pnpm build to compile the library up into something usable by node.

NOTE: This does not have to be done if running tests or if you use ts-node.

Tests

To run the tests, use pnpm test.

This repository has 100% test coverage, and that is enforced by our testing library.

We use Node TAP as our test runner, and we also use a slightly more obscure feature of it in the form of Snapshots.

You can generate snapshots with pnpm snap. This will create snapshots for all tests that expect them. We use snapshots for things like error message formatting, as it's generally the best way to do so.

Contributing

If you want to contribute an algorithm, give it a good name and create a file inside src/algorithms. Write all the functions related to it, and export the ones that should be public.

Then, write tests to cover 100% of it -- be brutal with your tests, as this is a small project and I'd like for it to stay very tidy!

Finally, just attach it to the exported API in src/main.ts. Simple!