Skip to content
The dAppest version of Colony, ever
TypeScript CSS JavaScript Other
Branch: master
Clone or download
area Merge pull request #1827 from JoinColony/maintenance/builds
Automatically build and push dapp images on successful builds
Latest commit 1afe189 Sep 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Fix mis-named CircleCI workflow Sep 16, 2019
.github Remove bug assignee Jul 6, 2019
cypress Codemod: Typescript Aug 23, 2019
docs Limit to 4 entries in list Aug 30, 2019
integration-testing Fix ava TS Aug 28, 2019
scripts First step on path to automated deploys/testing Sep 16, 2019
src Guard localForage usages for node Sep 13, 2019
ssl SSL all the things! Use mkcert to generate your own Dec 19, 2018
static Show naked mole rate as image instead of icon Jun 10, 2019
.babelrc Codemod: Typescript Aug 23, 2019
.dockerignore Add: docker ignore file Aug 27, 2019
.editorconfig Add Input Field Jul 3, 2018
.env.example Add more colonyJS config Jul 25, 2019
.eslintignore Use pinion instead of the pinningService Dec 19, 2018
.eslintrc.jest.js Enforce consistent tests via jest linting Dec 4, 2018
.eslintrc.js Disable eslint import resolver Aug 26, 2019
.flowconfig Upgrade ipfs and orbit-db Jun 19, 2019
.gitignore SSL all the things! Use mkcert to generate your own Dec 19, 2018
.gitmodules Use pinion instead of the pinningService Dec 19, 2018
.huskyrc Codemod: Typescript Aug 23, 2019
.lintstagedrc Codemod: Typescript Aug 23, 2019
.nvmrc Upgrade node to 10.16.3 Aug 26, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Aug 26, 2019
Deployment.md Add: infura project id to the deployment notes Jul 25, 2019
Dockerfile Update: docker file for debian stretch Aug 27, 2019
LICENSE Create LICENSE Aug 26, 2019
Readme.md Remove greenkeeper badge Sep 3, 2019
ava.config.js Use tsconfig-paths Aug 28, 2019
cypress.json Fix: cypress `claim username` spec remove timeout Mar 22, 2019
globals.d.ts Codemod: Typescript Aug 23, 2019
jest.conf.json Codemod: Typescript Aug 23, 2019
package.json Version: Bump dapp to `1.0.3` Sep 6, 2019
postcss.config.js Remove variables.css import from CSS modules Oct 18, 2018
renovate.json Preserve semver ranges Aug 30, 2019
styleguide.config.js Codemod: Typescript Aug 23, 2019
stylelint.config.js Disable length-zero-no-unit stylelint option Oct 18, 2018
tsconfig.json Include integration testing folder Aug 28, 2019
webpack.config.js Ignore css typings Aug 26, 2019
webpack.config.prod.js Update webpack config Aug 23, 2019
yarn.lock Remove plop (we are not using it) Sep 3, 2019

Readme.md

Colony Dapp

Prerequisites

(for versions see package.json -> engines)

  • A running docker daemon
  • Node.js
  • Yarn
  • mkcert (for self-signed SSL certificates)

Installation

Clone this repository :)

Setup docker

We use docker for:

  • Compiling the Solidity smart contracts

  • Running an IPFS node for the pinning service

  • You need to install docker on your machine, see the documentation for installation instructions.

  • We also assume docker is accessible as a non-root user, remember to complete the post-install instructions on linux.

Setup self-signed certificates for HTTPS

Various new browser technologies require the dev environment to be run via https. For that we need self-signed certificates for the domain you run the dApp in dev mode (most likely localhost or 127.0.0.1). We also can't just use "untrusted" self-signed certificates as IPFS won't run using those via secure websockets.

So we're using the great mkcert tool:

  1. Install mkcert using the instructions in their readme (mind the note regarding Firefox!)
  2. Install the root CA certificate: mkcert -install

Move on to the provision step. The needed certificates and corresponding keys will be generated automatically.

If you don't want to do a full provision you can also execute the following command (from the root repo directory):

mkdir -p ssl && cd ssl && mkcert localhost 127.0.0.1 ::1

This will create the certificate files needed.

Provision dependent libraries

This project depends on external libraries, so after cloning, they need to be provisioned:

yarn provision

Under the hood, this will initialize the submodules, install their packages, and build them. Furthermore this will create the SSL certificate needed to run the dev server

Install packages

yarn

Define environment variables

Firstly copy the example env file:

cp .env.example .env

Then customize the variables in the .env file to your needs.

When adding a new environment variable, you must add it to both files (otherwise, the dotenv-webpack plugin will throw an error); this is designed to keep the expected environment defined in a simple way.

To use the environment variables in the dApp:

const { MY_API_URL } = process.env;
console.log(MY_API_URL); // https://my-api-url.example.com/api

Running dev environment

yarn dev

This will run the whole stack which starts ganache, deploys the contracts, starts trufflepig and webpack. The webpack dev server will be available under https://localhost:9090 (mind the s after http!)

You can run these individually using the following commands:

yarn ganache
yarn contracts:deploy
yarn trufflepig
yarn webpack

Verbose logging

Set the environment variable VERBOSE to true to enable verbose mode logging in the browser console.

If you're brave enough to set the DEBUG environment variable, you'll get a lot of logging from modules we're using (e.g. IPFS). To disable this, you'll need to unset the environment variable and then run this in the browser console: localStorage.setItem('debug', undefined);.

Building the bundle locally

If you want to build the bundle locally for inspection, you can do it via:

yarn webpack:build

Note: It's a straight-up dev build. Just bundled, no code optimizations whatsoever.

Linting

Linting your code via eslint can be done as such:

yarn lint

To lint the project's style sheets you run:

yarn stylelint

Type checking

Type checking using flow can be accessed using this npm script:

yarn flow

Testing

To run unit tests you have the following npm script:

yarn test
You can’t perform that action at this time.