Skip to content

Development Guide

JellyAlex edited this page Oct 21, 2019 · 6 revisions

Polar.js development guide

The purpose of this short guide is to explain concepts and commands employed within Polar's development process.

Building

Quick explanation of how the GitHub actions and build.js file takes care of the docs, webpack and npm building. After the TypeScript code is written in src/, the code must be distributed in three different ways.

  • UMD: In the umd/ directory, the polar.min.js file is generated for use with the UNPKG cdn
  • npm: The npm registry only accepts .js files, so the library is completely converted into JavaScript in the dist/ directory. This means that people can bundle their own game with the polar.js dependency independently using tools such as webpack.
  • Docs: The builder also reads all the type docs in src and generates a documentation website in docs/

NPM Commands

  • npm run lint: Uses eslint to lint the whole project
  • npm run watch: Continually watches for file changes in src/ and outputs the polar.min.js file in the tests/ dir on any changes (for development builds)
  • npm run build: Builds the three directories above (umd/, docs/, dist/) (for release builds)

Github structure

  • master is for the current in development build
  • stable is for the latest stable version that would also be the latest version on npm
  • gh-pages is the docs for the stable branch (aka the one on npm too)

Github Actions

Whenever a push is sent to master, complete linting will be done, no building.

Whenever a push is sent to stable, the full build process will be sequenced, no linting as its assumed the linting was done before master was merged into stable.

Ts Declarations

Typescript declarations are included in the project and defined in the package.json, this means a user is able to build a TypeScript project with polar.js as a dependency seamlessly without the need to install types separately. These are included in the dist/ folder

Clone this wiki locally