# Simulation Platform

## Getting Started

### Requirements
1. Node 8.7.0+ (we recommend using `nvm` to manage node versions)
1. NPM 5.4.2

### Development
In order to To start up the development server, run the following command in project directory root (you may exclude *'nvm use && '* if you don't have nvm installed):

```sh
$ nvm use && npm i && npm start
```

This will install all defined module dependencies into a `/node_modules` folder and start the development server (`localhost:9000` by default).

NOTE for `npm link`ing of `react-uikit` you must first go to the react-uikit directory and:

```sh
$ npm link ../simulation-platform/node_modules/react
```

otherwise you will not be able to run the development server without it telling you that there are multiple instances of React being used.

## Distribution

### Building Bundles
The project is set up to create builds for `production`, `staging`, and `qa` environments.
To build a bundle, run one of the following commands:
```sh
# Build a production bundle
$ npm run build:prod

# Build a staging build
$ npm run build:dev

# Build a qa bundle
$ npm run build:qa
```

This will inject the appropriate environment variables defined in the [.env-cmdrc](./.env-cmdrc) file, bundle the project dependencies, transpile the source code, and output the build into `/build`.

**NOTE:** You can visually analyze a bundle by adding the following flag to your build command `-a | --analyze`.
```sh
$ npm run build:prod -- --analyze
```

### Testing
To run unit tests for the project, run the following command:
```sh
$ npm test
```

A task runner will scan the project for `test.js` files and execute the tests.

## Other
Additional commands can be located in the [package.json](./package.json) file

