Skip to content

Development Guide

Manolo Edge edited this page Oct 16, 2023 · 3 revisions

If you want to contribute to cardboard, you will first need to set up the project. It's very easy though.

Clone repo (or your fork)

git clone [email protected]:nombrekeff/cardboard-js.git

You will usually clone your forked repository.

Install dependencies

After cloning navigate into the project: cd cardboard-js And then install npm dependencies:

npm install

Project Structure

The project structure is very straightforward, if you've worked with JS or TS you will probably understand how most of it works. But here is a brief explanation:

  • dist -> Holds the built JS code, typescript output will go into this folder.
  • docs -> When building the project, docs are also generated from the TS code and JSDoc comments, and placed in this folder.
  • examples -> Hold a list of working examples written using Cardboard.
  • src -> The juice, this folder contains all the code that makes Cardboard.
    • ext -> Holds extensions for Cardboard (i.e. Tweening, Custom Components, etc...)
  • tests -> This is where we ensure everything works, of course, unit tests for Cardboard.

Building project

The project is written in TypeScript and built into ESM js (for now). There's no bundling at the moment.

For building we use tsc for compiling the TS code, and typedoc for generating the documentation.

  • For building the project:
npm run build
npm run build:watch
  • For building the examples (examples folder):
npm run build:example
npm run build:example:watch
  • For building the docs:
npm run build:docs

Running examples

You can do this in any way you want, you just need to launch a server that will host the example pages. I use an extension in VSCode called Liveserver. There are plenty of options:

Testing project

npm run test
npm run test:watch