Development Introduction
HPC-Cloud relies heavily on these libaries:
Front-End
- React: View library
- Redux: Data store and flow
- React-Router: Page routing
- PostCSS: Isolates and autoprefixes css classes and properties
- Axios: Network call library
- FontAwesome: Icons
In the /src
folder there are several folders:
config
: react-router routes confignetwork
: network stackpages
: app pages for react-router, each folder is a mapped to a route inconfig/routes.js
. e.g./pages/Simulation/View
maps to[hostname]/view/simulation/[some simulation id]
panels
: comming, reusable panels for use throughout the applicationredux
: redux data flow and storetools
: react wrappers for external toolsutils
: various helperswidgets
: similar to panels but more simpleworkflows
: simultion workflows
To get started with development on the front end, in your HPC-Cloud directory run:
# installs dependancies |
Dev tools
HPC-Cloud is written in ES6 it’s transpiled into ES5 with Babel.
Style
ESLint ensures that code style is followed and adhered to, we’re extending Airbnb’s rules. Webpack will throw errors if something is wrong. The basics are:
- Tab width is two spaces.
- No line padding at the beginning or end of a function.
var
must be declared at the top of the scope, useconst
orlet
otherwise.- Spaces surround properties in objects, also one space before the value e.g.
{ foo: bar }
; - Comma after the final property in objects which are declared over multiple lines.
- Open brackets are on the same line as the declaration. e.g.
function qux() { \n
- Anonymous functions must be ES6 arrow function.
- String concatenation must be ES6 string templates.
Test tools
For a full overview of testing consult /test/README.md.
- Karma: with karma-webpack and istanbul-instrumenter - test runner, transpiles tests with a webpack extension.
- Jasmine - test framework
- expect - assertion library
- PhantomJS - headless webkit environment for testing in
- babel-polyfill - PhantomJS has no Promise object, so we supplement it with this.
- redux-actions-assertions - Redux tests only, but can be used for component tests which use redux.
- React Test Utils - For tests involving React components