Skip to content

Commit

Permalink
Updates README (decred#1036)
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth Benton authored and fernandoabolafio committed Mar 15, 2019
1 parent bea0c6c commit db22943
Showing 1 changed file with 50 additions and 15 deletions.
65 changes: 50 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,87 @@
# Politeia GUI

## Development
Politeiagui is the web frontent for [Politiea](https://github.com/decred/politeia), Decred's [proposal system](https://proposals.decred.org/).


## Requirements

Politeiagui uses node.js and the yarn package manager.

### Requirements
- [node](https://nodejs.org/en/download/)
- [yarn](https://yarnpkg.com/en/)
- [politeiawww](https://github.com/decred/politeia)

**Note:** Politeiagui can be run as a standalone application that uses mock APIs to simulate communicaiton with the Politeia backend (useful if you're only doing UI changes). In this case, `politeiawww` isn't needed. However, be aware that the Mock APIs are not always up-to-date with the latest changes.



## Development


1. Clone this repository

`https://github.com/decred/politeiagui.git`


### With mock APIs
1. Build and run locally.

yarn && yarn uidev
**Against politeiawww**

To run politeiagui against `politeiawww`, make sure `politeiawww` is running and use the following command:

`yarn && yarn start`

### Against politeiawww
**Mock APIs (WARNING: may be out of date)**

yarn && yarn start
To run politeiagui using mock APIs that do not communicate with `politeiawww` (useful for working on UI changes only), run the following command:

`yarn && yarn uidev`




## Production

To build politeiagui for production deployment, use the following commands:

yarn && yarn build
ls build

## package.json
## Configuration


The package.json file has the field "network" (testnet or mainnet),
which we need in order to get the last block height.
By default, politeiagui is configured to use Decred's testnet blockchain. To use the mainnet blockchain, change the "network" field in `package.json` to "mainnet".

It is necessary for politeiagui to connect to the testnet or mainnet in order to get the last block height, and determine the status of votes.

This way it is possible to determine when a vote has finished or not.
---

## Testing

This code has currently unit tests for the core logic. Currently covering lib files (`/src/lib/*`) and actions files (`/src/actions/*`).
Politeiagui has unit tests for its core logic. To run all unit tests run the command:

yarn test


Test coverage is currently provided for (`actions/*`), (`lib/*, reducers/*`) and (`selectors/*`).


Relevant libraries/modules used for testing are:

- [Jest](https://facebook.github.io/jest/docs/en/getting-started.html) - Javascript testing
- [fetch-mock](http://www.wheresrhys.co.uk/fetch-mock/api) - Mock http requests
- [redux-mock-store](https://github.com/dmitry-zaets/redux-mock-store) and [redux-actions-assertions](https://github.com/redux-things/redux-actions-assertions) for testing redux actions.

There is more testing to be done, you can check it on this opened issue: https://github.com/decred/politeiagui/issues/376


## Docker

`politeia` can be hosted in a docker container. To build the site and the docker container:
Politeiagui can also be hosted in a docker container. To build the the docker container, run the following commands:

```bash
$ ./bin/build.sh
```

The container can then be run with
Then run the container with:

```bash
$ docker run -d --rm -p <local port>:80 decred/politeiagui:latest
Expand Down

0 comments on commit db22943

Please sign in to comment.