Environment Setup
This document helps you setting up the developer environment. It is useful if you would like to contribute to the codebase of the engine or the website.
Quick Start
After cloning the repository run these commands from the root directory.
npm install
npm start
This will compile the development version of the code and start a web server. Now you can open http://localhost:8080
to check the result.
Environments
The solution is implemented as ES6 modules. It means that it must be bundled together to one file to make it usable on the website. The development and production environment is separated, see the Scripts section for more details.
- Development: The development bundle will be created in the
build
folder. The code of the website references this directly during development, so you can just open thewebsite
folder and try it out. - Production: The entire self-containing package will be created in the
build
folder. In this case all the required files are copied to this folder so you can just upload it to any web server to make it work.
Source Structure
The source contains the following folders.
- assets: Various assets used in the code or in any other media platforms.
- docs: Code of this documentation.
- sandbox: Various examples mostly for using the engine.
- source: Source code of the engine and the website.
- engine: Source code of the engine. It doesn't contain any website specific codes.
- website: Source code of the website.
- test: Automatic tests for the engine.
- tools: Tools for building the library.
- website: Static resources for the website.
Scripts
Several scripts are available for building, testing and publishing.
Building
npm run build_dev
: Builds the development version of the engine and the website.npm run build_engine_dev
: Builds the development version of the engine.npm run build_engine
: Builds the production version of the engine.npm run build_engine_module
: Builds the ES6 module version of the engine. This is the main entry point when using the npm package.npm run build_website_dev
: Builds the development version of the website.npm run build_website
: Builds the production version of the website.
Testing
npm run test
: Runs all unit tests.npm run lint
: Runs eslint on the codebase.
Packaging
npm run create_package
: Generates the production version of the engine and the website.npm run create_dist
: Generates the production version of the engine and the website, and runs all the possible checks.
Tools
npm run generate_docs
: Generates this documentation.npm run generate_icon_font
: Generates the icon font used on the website.