Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

peng, billy/696 monorepo spike #722

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
163 changes: 137 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,160 @@
# template for node apps
node_app: &node_app
docker:
- image: circleci/node:9.4.0-browsers
working_directory: ~/cosmos-ui

# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:9.4.0-browsers
voyager:
<<: *node_app
environment:
- BINARY_PATH: "/home/circleci/repo/gaia"
- NODE_BINARY_PATH: "/home/circleci/repo/gaiad"

working_directory: ~/repo
- BINARY_PATH: "/home/circleci/cosmos-ui/voyager/gaia"
- NODE_BINARY_PATH: "/home/circleci/cosmos-ui/voyager/gaiad"

steps:
- checkout
- run: bash ./changelog-changed-check.sh

- run: cd voyager && bash ./changelog-changed-check.sh

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-root-{{ checksum "package.json" }}
- v1-dependencies-root-{{ checksum "voyager/package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-root-

- run: yarn
- run: cd voyager && yarn

- save_cache:
paths:
- yarn.lock
- node_modules
key: v1-dependencies-root-{{ checksum "package.json" }}
- voyager/yarn.lock
- voyager/node_modules
key: v1-dependencies-root-{{ checksum "voyager/package.json" }}

- run:
name: Add Gaia
name: Download Gaia
command: |
sudo wget https://okw.me/gaiacli-0.17.0-ubuntu -O ~/repo/gaia
sudo chmod o+wx ~/repo/gaia
sudo wget https://okw.me/gaiad-0.17.0-ubuntu -O ~/repo/gaiad
sudo chmod o+wx ~/repo/gaiad
sudo wget https://okw.me/gaiacli-0.17.0-ubuntu -O ~/cosmos-ui/voyager/gaia
sudo chmod o+wx ~/cosmos-ui/voyager/gaia
sudo wget https://okw.me/gaiad-0.17.0-ubuntu -O ~/cosmos-ui/voyager/gaiad
sudo chmod o+wx ~/cosmos-ui/voyager/gaiad

- run:
- run:
name: Test
command: yarn run test
command: cd voyager && yarn test
no_output_timeout: 120
- run: bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN

- run: cd voyager && bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN

explorer:
<<: *node_app
steps:
- checkout
- run: cd explorer && yarn
- save_cache:
paths:
- explorer/yarn.lock
- explorer/node_modules
key: v1-dependencies-root-{{ checksum "explorer/package.json" }}
- run: cd explorer && yarn build

allinbits.com:
<<: *node_app
steps:
- checkout
- run: cd allinbits.com && yarn
- save_cache:
paths:
- allinbits.com/yarn.lock
- allinbits.com/node_modules
key: v1-dependencies-root-{{ checksum "allinbits.com/package.json" }}
- run: cd allinbits.com && yarn build

cosmos.network:
<<: *node_app
steps:
- checkout
- run: cd cosmos.network && yarn
- save_cache:
paths:
- cosmos.network/yarn.lock
- cosmos.network/node_modules
key: v1-dependencies-root-{{ checksum "cosmos.network/package.json" }}
- run: cd cosmos.network && yarn build

ether.peg.zone:
<<: *node_app
steps:
- checkout
- run: cd ether.peg.zone && yarn
- save_cache:
paths:
- ether.peg.zone/yarn.lock
- ether.peg.zone/node_modules
key: v1-dependencies-root-{{ checksum "ether.peg.zone/package.json" }}
- run: cd ether.peg.zone && yarn build

ethermint.peg.zone:
<<: *node_app
steps:
- checkout
- run: cd ethermint.peg.zone && yarn
- save_cache:
paths:
- ethermint.peg.zone/yarn.lock
- ethermint.peg.zone/node_modules
key: v1-dependencies-root-{{ checksum "ethermint.peg.zone/package.json" }}
- run: cd ethermint.peg.zone && yarn build

interchain.io:
<<: *node_app
steps:
- checkout
- run: cd interchain.io && yarn
- save_cache:
paths:
- interchain.io/yarn.lock
- interchain.io/node_modules
key: v1-dependencies-root-{{ checksum "interchain.io/package.json" }}
- run: cd interchain.io && yarn build

tendermint.com:
<<: *node_app
steps:
- checkout
- run: cd tendermint.com && yarn
- save_cache:
paths:
- tendermint.com/yarn.lock
- tendermint.com/node_modules
key: v1-dependencies-root-{{ checksum "tendermint.com/package.json" }}
- run: cd tendermint.com && yarn build

tendermint-vue:
<<: *node_app
steps:
- checkout
- run: cd tendermint-vue && yarn
- save_cache:
paths:
- tendermint-vue/yarn.lock
- tendermint-vue/node_modules
key: v1-dependencies-root-{{ checksum "tendermint-vue/package.json" }}
- run: cd tendermint-vue && yarn build

workflows:
version: 2
build_all:
jobs:
- explorer
- voyager
- allinbits.com
- cosmos.network
- interchain.io
- tendermint.com
- tendermint-vue
- ether.peg.zone
- ethermint.peg.zone
203 changes: 2 additions & 201 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,202 +1,3 @@
![the cosmos network](cosmos-github.jpg)
# Cosmos UI

# Cosmos Voyager

[![CircleCI](https://circleci.com/gh/cosmos/voyager.svg?style=svg)](https://circleci.com/gh/cosmos/voyager)
[![codecov](https://codecov.io/gh/cosmos/voyager/branch/develop/graph/badge.svg)](https://codecov.io/gh/cosmos/voyager)

👋 Welcome to Voyager, the official user interface for the [Cosmos Network](https://cosmos.network/).

💻 Voyager is a desktop application built with [Electron](https://github.com/electron/electron). Voyager runs on macOS 10.9+, Windows 7+, and Debian-based Linux distros.

⚠️ This is still alpha-level software. **DO NOT** enter your Cosmos fundraiser seed into Voyager.

🎉 Binary releases are [available here](https://github.com/cosmos/voyager/releases).

---

### Prerequisites

#### Install dependencies

##### On Mac

Install Yarn for JavaScript dependencies. This will also install Node.js if necessary.

```bash
brew install yarn
```

##### On Windows

Install [Yarn](https://yarnpkg.com/lang/en/docs/install/#windows)

#### Install Gaia Binaries (Cosmos SDK)

Install the Gaia-CLI (`gaiacli`) and the Gaia full node binary (`gaiad`) which are part of the Cosmos SDK by following [the instructions](https://cosmos-sdk.readthedocs.io/en/develop/sdk/install.html).

#### Prepare Voyager

```bash
# checkout voyager
cd ~ # or wherever you like to keep your project files
git clone https://github.com/cosmos/voyager.git
cd voyager

# install js dependencies
yarn
```

---

### Develop

To run Voyager on the default testnet (`gaia-2`):

```bash
$ yarn testnet
```

To run Voyager on a specific testnet from the [testnets](https://github.com/tendermint/testnets) repo:

```bash
$ yarn testnet <networkName>
```

To run Voyager on a local node:

<!-- This way would be desired but local nodes apparently do not work (do not produce blocks)```bash
# First start a local node using the the configuration provided in Voyager.
$ gaia node start --home=./app/networks/local
# Then start Voyager connecting to your local node.
$ yarn testnet local
``` -->

First start a local node following the Gaia [readme](https://github.com/cosmos/gaia).

Then start Voyager pointing at your local node.

```bash
$ COSMOS_NODE=localhost yarn testnet
```

---

### Production

Building requires that [Docker](https://www.docker.com/get-docker) is installed
on your system.

Here's an example build command:

```shell
yarn run build --commit=HEAD --network=app/networks/gaia-5001 --platform=darwin --sdk-commit=35d0e34b2674ad9edf0f074167dd967219dbbe1b
```

You can specify `--help` to see all options with explanations.

Run the app.

```bash
open builds/Cosmos-{platform}-x64/Cosmos.app
```

When you are testing the build system you can skip the repackaging of the JS files.

```bash
$ yarn run build --platform=darwin --skip-pack
```

To test if your build worked run:

```bash
$ yarn test:exe {path to the build executable}
```

To make an official release, follow the instructions in `docs/release.md`.

---

### Testing

Voyager is using [Jest](https://facebook.github.io/jest) to run unit tests.

```bash
$ yarn test
```

To check test coverage locally run following. It will spin up a webserver and provide you with a link to the coverage report web page.

```bash
$ yarn test:coverage
```

---

### Debug

To debug the electron application, build it and run the node inspector for the built files:

```bash
$ electron --inspect-brk builds/{{your build}}/resources/app/dist/main.js
```

Then attach to the debugger via the posted url in Chrome.

To debug the electron view, set the environment variable `COSMOS_DEVTOOLS` to something truthy like `"true"`. The Chrome DevTools will appear when you start Voyager.

To see the console output of the view in your terminal, set the environment variable `ELECTRON_ENABLE_LOGGING` to something truthy like `1`.

### Flags

A list of all environment variables and their purpose:

| Variable | Values | default | Purpose |
| ----------------------- | -------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------- |
| NODE_ENV | 'production', 'development' | | |
| LOGGING | 'true', 'false' | 'true' | Disable logging |
| COSMOS_NETWORK | {path to network configuration folder} | '../networks/gaia-1' | Network to connect to |
| COSMOS_HOME | {path to config persistence folder} | '$HOME/.cosmos-voyager[-dev]' | |
| COSMOS_NODE | {ip of a certain node} | | Node to connect to |
| COSMOS_DEVTOOLS | 'true', 'false' | 'false' | Open the debug panel in the electron view |
| ELECTRON_ENABLE_LOGGING | 'true', 'false' | 'false' | Redirect the browser view console output to the console |
| PREVIEW | 'true', 'false' | 'true' if NODE_ENV 'development' | Show/Hide features that are in development |
| COSMOS_E2E_KEEP_OPEN | 'true', 'false' | 'false' | Keep the Window open in local E2E test to see the state in which the application broke. |

### FAQ

* If tendermint crashes and the log shows `Tendermint state.AppHash does not match AppHash after replay.` delete the config folders at `$HOME/.cosmos-voyager[-dev]`.

* If you use yarn, the post-install hook may not execute. If this happens you'll have to execute the script manually:

```bash
$ cd app
$ yarn
$ cd ..
$ npm run rebuild
```

* If electron shows the error: `A DLL initialization routine has failed.` rebuild the electron dependencies:

```bash
$ npm run rebuild
```

* If you have trouble installing dependencies, remove all the lockfiles and try installing again.

```bash
$ rm -rf app/yarn.lock
$ rm -rf app/package-lock.json
$ rm -rf yarn.lock
$ rm -rf package-lock.json
```

* If your components are not found using a short path, check if the path resolution is applied for Webpack (`webpack.renderer.js > rendererConfig.resolve.alias`) and Jest (`package.json > jest.moduleNameMapper`).

* If starting the development server fails with the error: `Error: listen EADDRINUSE 127.0.0.1:9080`, you have still a development server process running. Kill it with `kill $(lsof -t -i:9080)` on Unix systems. On Windows Powershell first look for the processes with `netstat -a -o -n | Select-String -Pattern "9080"` then kill them with `taskkill /F /PID {PID}`.

- If `yarn test:e2e` outputs an error about ChromeDriver timeout, remove your node_modules folder and reinstall all dependencies.

---

### ✌️
This is the monorepo for all Cosmos UI projects.
6 changes: 6 additions & 0 deletions allinbits.com/.agignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules/
/dist/
/dist_master/
/static/
stats.json
npm-shrinkwrap.json
Loading