Home

Awesome

Game On! Web Frontend

Codacy Badge

Check out our core system architecture to see how the "webapp" service fits.

Contributing

Want to help! Pile On!

Contributing to Game On!

Building and testing the web front end

The build requires node 6, and uses Gulp to manage builds, and Karma with PhantomJS to run tests.

Gulp tasks:

Natively

The build requires node 6, and uses Gulp to manage builds, and Karma with PhantomJS to run tests.

$ cd app
$ npm install
$ $(npm bin)/gulp build

In a Container!

If you don't have (or don't want!) node, Gulp, and/or PhantomJS installed (or if PhantomJS is just being a pain), don't worry, we have you covered! The image created by Dockerfile-node contains everything you need to build and unit test the web front end.

TL;DR: Use the build.sh script, with the following actions:

Note: if you see an error like setrlimit RLIMIT_NOFILE: Operation not permitted on Linux, then you need to raise your file handle limit. How to do this varies by distribution, as the configuration value is kept in /etc/security/limits.conf, /etc/systemd/user.conf and /etc/systemd/system.conf (or some subset, or combination, depending on how the system is configured).

Build using Docker Compose (from the gameon project)

If you're building from the top-level gameon project with docker-compose, copy the following from docker/docker-compose.override.yml.example into docker/docker-compose.override.yml:

services:
  webapp:
    build:
      context: ../webapp
    volumes:
      - '../webapp/app/dist:/opt/www/public'

After that, use docker/go-run.sh to manage rebuilding and starting the web front-end:

./docker/go-run.sh rebuild webapp

Running tests

By default, we use Karma with PhantomJS for unit testing:

$ cd app
$ $(npm bin)/gulp test

The image used for building has phantomjs within it. If you want to run tests natively, it's up to you to install PhantomJS in whatever way suits you best.

Live development with BrowserSync

$ ./build.sh cert  # generate the test certificate
$ cd app
$ $(npm bin)/gulp serve