Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 2.38 KB

README.dev.md

File metadata and controls

54 lines (42 loc) · 2.38 KB

Developing in this monorepo

There are a few directories in this monorepo:

  • box2d
    • This is a git submodule of the box2d C++ source code.
  • box2d-wasm
    • Compiles box2d to WebAssembly
    • Creates .js bindings to WebAssembly functionality
      • Exported functionality is described as .idl WebIDL bindings
      • Bindings emitted via WebIDL binder
    • Creates .d.ts declarations for .js bindings
  • webidl-to-ts
    • Generates TypeScript .d.ts declarations from .idl WebIDL bindings files.
      • .idl file parsed using W3C's WebIDL parser
      • TypeScript declarations created with TypeScript Compiler API
  • integration-test
    • For testing changes you've developed to box2d-wasm
    • Svelte application that demonstrates how to consume box2d-wasm via TypeScript
  • demo
    • Examples of how to integrate box2d-wasm into your application

Clone repository

Clone this repository using --recursive, to ensure that the box2d submodule is available.
Tutorial: Using submodules in Git

# start in root of repository
git clone --recursive git@github.com:Birch-san/box2d-wasm.git
cd box2d-wasm

Instantiate packages

pnpm is used to manage packages in this monorepo. In particular, it creates a symlink that enables integration-test to consume build artifacts from box2d-wasm.

# from root of repository
npm i -g pnpm
pnpm i
# compile webidl-to-ts from TS to JS, so that box2d-wasm can consume it to generate typings
pnpm --filter=webidl-to-ts build

Compile Box2D to WASM + generate .js and .d.ts bindings

See README of box2d-wasm package.

Test box2d-wasm functionality inside an application

See README of integration-test package.