- Getting Toga working locally
- Installation
- Running the servers
- Viewing the components
- Testing
- Getting Toga working with Docker
- Installation
- Running the servers
- Viewing the components
- Testing
- Toga Workflow
- Toga Server
- Toga Components
- Submitting code
- Node.js v6.2.2 - Recommend using NVM
- npm v3.10.3
- PhantomJS i.e.
brew install phantomjs
ornpm install -g phantomjs-prebuilt
Install node module dependencies
npm install
To have all components ready for serving without compiling on the fly, run
npm run bundle
npm start
Spins up a server under the port of 3001
npm run dev
All components can be previewed once the servers are up and running using the localhost url and the name of the component.
To view Components, any required props must be set within the context of that component using the url. e.g.
http://localhost:8080/button.html?context={"children":"button text","fullWidth":true,"size":"large"}
Our unit tests are written with the help of Enzyme and a few variations of Chai (sinon-chai, chai-as-promised, chai-enzyme)
npm run lint
npm run test-unit
ornpm run test-unit -- --watch
We have end-to-end tests which uses Nightwatch and PhantomJS :
npm run test-e2e
Install node module dependencies
Docker
- Recommend using native installations
- https://docs.docker.com/engine/installation/mac/
- https://docs.docker.com/engine/installation/linux/
- https://docs.docker.com/engine/installation/windows/
docker-compose
- Comes packaged with Docker
Starts the server without any development dependencies. This is the closest approximation to what will run on QA and Production environments.
docker-compose up
Watches for changes in the following folders and restarts the application picking up the changes.
app
components
script
docker-compose -f ./docker-compose-dev.yml up
NOTE: Upon making changes in package.json
, you will need to rebuild the docker container for the respective environment.
docker-compose build
docker-compose -f ./docker-compose-dev.yml build
When running in Docker the components are available on the same domain and port as a local installation.
Run the unit and integration tests within the docker container.
docker-compose -f ./docker-compose-testing.yml run toga
To run the test and watch for changes, this will have to be run locally until it is integrated with Docker.
npm test -- --watch
This has not yet been integrated with Docker and will need to be run locally
The Toga Server uses Breadboard which means the code and testing is different from what you might expect. Please take a look over the Breadboard README.md to understand how this works.
The Toga Server code lives within /app
and the corresponding tests within /tests
.
Components should be developed in a separate repo which will then be linked during startup following the guide in the README.md.
The only exceptions are components which show particular functionality of toga it live in the example components.
The Toga Components is a collection of React components which include a toga.json
file in the root.
Toga Components should be universal i.e. written so that they can be rendered server-side and client-side.
We would love some extra hands to help improve the Toga server and the Toga Components. If you want to help, please try to follow the following workflow to help make PRs accepted quickly.
- Raise an issue
- create a branch
- Write tests
- Submit a PR