There are a few directories in this monorepo:
box2d
- This is a git submodule of the
box2d
C++ source code.
- This is a git submodule of the
box2d-wasm
- Compiles
box2d
to WebAssembly- Compiled using Emscripten toolchain
- Creates
.js
bindings to WebAssembly functionality- Exported functionality is described as
.idl
WebIDL bindings - Bindings emitted via WebIDL binder
- Exported functionality is described as
- Creates
.d.ts
declarations for.js
bindings- Declarations generated by
webidl-to-ts
- Declarations generated by
- Compiles
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
- Generates TypeScript
integration-test
- For testing changes you've developed to
box2d-wasm
- Svelte application that demonstrates how to consume
box2d-wasm
via TypeScript
- For testing changes you've developed to
demo
- Examples of how to integrate
box2d-wasm
into your application
- Examples of how to integrate
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 [email protected]:Birch-san/box2d-wasm.git
cd box2d-wasm
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
See README of box2d-wasm
package.
See README of integration-test
package.