Skip to content

Commit

Permalink
Separate apps (#69)
Browse files Browse the repository at this point in the history
* make compound work

* make it work tx-builder and walletConnect

* update scripts

* move workspaces into app folder

* wallet-connect: accept uri as pasted value.

* Update README

* remove storybook

* refactor connection logic

* update instructions

* update placeholder input

* Cleanup unnecessary dependencies on each package

* Fix homepage to be able to deploy in IPFS

* Update screen snapshot to clipboard command in Mac

* Set v2.0.0

Co-authored-by: Daniel Sanchez <[email protected]>
  • Loading branch information
nicosampler and Daniel Sanchez authored Nov 12, 2020
1 parent 173a4dd commit 0eb5fca
Show file tree
Hide file tree
Showing 95 changed files with 1,393 additions and 4,150 deletions.
9 changes: 2 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# DEVELOPMENT
HTTPS=false
PORT=3002
BROWSER=none

# Set this var ONLY if you want to use local provider, like MetaMask
REACT_APP_LOCAL_WEB3_PROVIDER=false

# PRODUCTION
REACT_APP_WEB3_PROVIDER_URL=https://rinkeby.infura.io/v3/someToken
REACT_APP_RPC_TOKEN=
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
node_modules
/.pnp
.pnp.js
yalc.lock
Expand All @@ -11,7 +11,7 @@ yalc.lock
/coverage

# production
/build
build

# misc
.DS_Store
Expand Down
9 changes: 0 additions & 9 deletions .storybook/main.js

This file was deleted.

6 changes: 0 additions & 6 deletions .storybook/manager.js

This file was deleted.

9 changes: 0 additions & 9 deletions .storybook/preview.js

This file was deleted.

5 changes: 0 additions & 5 deletions .storybook/theme.js

This file was deleted.

79 changes: 0 additions & 79 deletions .travis.yml

This file was deleted.

33 changes: 26 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

[![Logo](https://raw.githubusercontent.com/gnosis/safe-react-apps/master/assets/logo.png)](https://gnosis.pm/)

[![Build Status](https://travis-ci.org/gnosis/safe-react-apps.svg?branch=master)](https://travis-ci.org/gnosis/pm-contracts)
[![Build Status](https://travis-ci.com/gnosis/safe-react-apps.svg?branch=master)](https://travis-ci.com/gnosis/safe-react-apps)

This project contains the apps developed by gnosis to be consumed by Safe Multisig.
This project contains the apps developed by Gnosis to be consumed by Safe Multisig.


## Install
Expand All @@ -15,26 +15,45 @@ This project contains the apps developed by gnosis to be consumed by Safe Multis
yarn install
```

## Configure

Configure your `.env` file starting from `.env.example` one. Fill the provided example values with the necessary information. Don't forget to add your infura API key

## Build

We use yarn workspaces to handle different apps inside this project. To build each app you can use one of the following commands:

```bash
yarn build
yarn build-compound
yarn build-tx-builder
yarn build-wallet-connect
```

### Run locally
You can also run this apps locally using the following commands:

```bash
yarn start-compound
yarn start-tx-builder
yarn start-wallet-connect
```


## Project structure
In `./src/apps` you can find one folder per each integration app Gnosis develops.

Also, as each app must expose a `manifest.json` in order to be accepted by Safe Multisig, in `./public` folder you can find a folder per each app. Besides the `manifest.json` file we also include the Icon for each app.
In `./apps` you can find one folder per each integration app Gnosis develops.

Also, each app must expose a `manifest.json` in order to be accepted by Safe Multisig, you can find it in their `./public` folder. Besides the `manifest.json` file we also include the app Icon.

This will allow Safe Multisig to consume these resources like so: `https://apps.gnosis.io/compound/manifest.json`

## How to Develop a third-party App

Documentation in how to develop and integrate your third-party app can be found [here](https://docs.gnosis.io/safe/docs/sdks_safe_apps/).
Documentation about how to develop and integrate your third-party app can be found [here](https://docs.gnosis.io/safe/docs/sdks_safe_apps/).

## For developers

Modify this file `safe-apps/node_modules/react-scripts/config/webpackDevServer.config.js` by adding these lines:
Inside each app folder you can find a `config-overrides.js` that shows how to modify headers with the next information. This is necessary for your app to work properly.

```
headers: {
Expand Down
29 changes: 29 additions & 0 deletions apps/compound/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* config-overrides.js */
const path = require("path");
const ModuleScopePlugin = require("react-dev-utils/ModuleScopePlugin");

module.exports = {
// The function to use to create a webpack dev server configuration when running the development
// server with 'npm run start' or 'yarn start'.
// Example: set the dev server to use a specific certificate in https.
devServer: function(configFunction) {
// Return the replacement function for create-react-app to use to generate the Webpack
// Development Server config. "configFunction" is the function that would normally have
// been used to generate the Webpack Development server config - you can use it to create
// a starting configuration to then modify instead of having to create a config from scratch.
return function(proxy, allowedHost) {
// Create the default config by calling configFunction with the proxy/allowedHost parameters
const config = configFunction(proxy, allowedHost);

config.headers = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET",
"Access-Control-Allow-Headers":
"X-Requested-With, content-type, Authorization",
};

// Return your customised Webpack Development Server config.
return config;
};
},
};
59 changes: 59 additions & 0 deletions apps/compound/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "compound",
"version": "1.0.0",
"private": true,
"homepage": "./",
"dependencies": {
"@apollo/react-hooks": "^3.1.3",
"@gnosis.pm/safe-apps-sdk": "0.4.2",
"@gnosis.pm/safe-react-components": "^0.3.0",
"@rmeissner/safe-apps-react-sdk": "^0.3.4",
"apollo-boost": "^0.4.7",
"big-number-input": "^1.0.2",
"big.js": "^5.2.2",
"graphql": "^14.6.0",
"lodash": "^4.17.15",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.4.1",
"styled-components": "^5.2.0",
"web3": "^1.2.5"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.0.0",
"@testing-library/react": "^11.0.0",
"@testing-library/user-event": "^12.0.0",
"@types/big.js": "^4.0.5",
"@types/jest": "^26.0.0",
"@types/lodash": "^4.14.154",
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@types/react-router-dom": "^5.1.3",
"@types/styled-components": "^5.1.0",
"react-app-rewired": "^2.1.6",
"react-docgen-typescript-loader": "^3.7.1",
"typescript": "^4.0.2"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
File renamed without changes
43 changes: 43 additions & 0 deletions apps/compound/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/Compound.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Compound safe-app. Money markets on the Ethereum blockchain"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/Compound.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Compound safe-app</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
5 changes: 5 additions & 0 deletions apps/compound/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Compound",
"description": "Money markets on the Ethereum blockchain",
"iconPath": "Compound.png"
}
File renamed without changes.
Loading

0 comments on commit 0eb5fca

Please sign in to comment.