Skip to content
Logo

Contributing

Thanks for wanting to help with the RedSpaceM SDK! This page covers how to build, test and publish the packages.

Requirements

  • Bun 1.3+ — runtime, package manager and test runner.
  • Git for version control.

Repository layout

packages/@redspacem/
  server-types/   # typed mp.* contract + helpers
  rpc/            # type-safe RPC layer
  client-types/   # client-side API types
  browser-types/  # CEF/NUI bridge types
  di/             # tiny DI container
  testing/        # mocks for unit tests
examples/freeroam # example gamemode resource
docs/             # documentation (EN + RU)

Setup

bun install

Common commands

bun run lint        # Biome check (formatter + linter)
bun run format      # Biome format --write
bun run typecheck   # tsc --noEmit in every workspace package
bun test            # bun test across the workspace
bun run build       # compile dist/ for every package (topological order)

bun run build compiles each package with tsc -p tsconfig.build.json into dist/index.js + dist/index.d.ts. Packages are built in dependency order (see the root package.json).

Note: typecheck/test resolve sibling packages through their published exports (which point at dist/), so run bun run build at least once after a fresh clone before bun run typecheck / bun test.

Code conventions

  • Strict TypeScript; the per-package tsconfig.json extends ../../tsconfig.base.json.
  • Biome: line width 100, double quotes, semicolons always, imports organized, noExplicitAny is an error.
  • No comments unless they add real value (doc comments on public API are welcome).
  • Tests live next to sources as src/*.test.ts and import from ../src/index.ts (not dist/).

Adding or changing a package

  1. Keep packages focused and dependency-light.
  2. Update src/index.ts, add/adjust src/*.test.ts.
  3. Keep the package's package.json metadata accurate (description, keywords, license, repository).
  4. Run the full suite: bun run lint, bun run build, bun run typecheck, bun test.

Publishing

Publishing is done per-package, in dependency order, from a tagged release (vX.Y.Z). CI runs it automatically via the publish workflow; to publish locally:

bun run build                    # ensure dist/ is current
bun pm login                     # authenticate with npm
for pkg in server-types rpc client-types di browser-types testing; do
  (cd packages/@redspacem/$pkg && bun publish --access public)
done

Order matters: server-types → rpc → client-types → di → browser-types → testing.

Checklist before publishing

  • bun run lint, bun run build, bun run typecheck, bun test all green
  • version bumped and tagged in git
  • bun publish --dry-run shows package.json, dist/* and LICENSE
  • No secrets in the repository (.env files are git-ignored)