Skip to content

Latest commit

History

History
75 lines (54 loc) 路 2.22 KB

File metadata and controls

75 lines (54 loc) 路 2.22 KB

Contributing to KAPLAY

Hey! Welcome to the Contribution guide, thanks for your interest in contributing to KAPLAY.

Prerequisites

Cloning the repository

# Clone repository
git clone https://github.com/kaplayjs/kaplay.git # to clone the repo.
# Enter to project dictory
cd kaplay 
# Install dependencies
npm install 
# Run dev command
npm dev

Additionally, for running tests you will need to run the following command:

npm run test:setup # This will install setup and install browsers for playwright.

Editing examples

  1. Pick on example to test and edit the corresponding /examples/[name].js, or create a new file under /examples to test anything you're working on.
  2. The source entry point is src/kaplay.ts, editing any files referenced will automatically trigger rebuild. Make sure not to break any existing examples.
  3. Run npm run dev to start the dev server and try examples.

Documentation

KAPLAY API documentation is auto-generated by JSDoc comments in the source code.

Normally the definitions of components, types, interfaces (i.e: SpriteComp, Vec2, RectComp, LifespanCompOpt) are on their own files. For example

  • src/components/draw/sprite.ts for SpriteComp
  • src/math/math.ts for Vec2
  • src/components/draw/rect.ts for RectComp
  • src/components/misc/lifespan.ts for LifespanCompOpt

Your best option is use ctrl + click on the type to go to the definition and see the JSDoc comments. Other option is to use the search feature of your IDE.

Commiting your changes

  1. Follow our conventional commits format. You can see how seeing the commit history.
  2. npm run check to check TypeScript.
  3. npm run fmt to format.

Conventional Commits Guide

This guide should be followed for all commits to the repository, and also for issues and PRs.

A commit starts with a type, a scope, and a subject:

<type>(<scope>): <subject>
  • The type is mandatory.
  • We don't use the scope right now, you must omit it. This may change in the future.
  • The subject must be a short description of the change. Use the imperative, present tense: "change" not "changed" nor "changes".