Git Product home page Git Product logo

aragon-react-boilerplate's Introduction

Aragon Buidler Boilerplate

πŸ•΅οΈ Find more boilerplates using GitHub | ✨ Official boilerplates

▢️ To use this boilerplate, run npx create-aragon-app <app-name>

Buidler + React boilerplate for Aragon applications.

Running your app

To run the app in a browser with frontend and contract hot-reloading, simply run npm start.

  1. Add code quality tools, like JS and contract linting. You may also want to check existing buidler plugins.
  2. Develop your AragonApp contract
  3. Develop your frontend
  4. Publish!

What's in this boilerplate?

npm Scripts

  • postinstall: Runs after installing dependencies.
  • build-app: Installs front end project (app/) dependencies.
  • start Runs your app inside a DAO.
  • compile: Compiles the smart contracts.
  • test: Runs tests for the contracts.
  • publish:major: Releases a major version to aragonPM.
  • publish:minor: Releases a minor version to aragonPM.
  • publish:patch: Releases a patch version to aragonPM.

Hooks

These hooks are called by the Aragon Buidler plugin during the start task's lifecycle. Use them to perform custom tasks at certain entry points of the development build process, like deploying a token before a proxy is initialized, etc.

Link them to the main buidler configuration file (buidler.config.js) in the aragon.hooks property.

All hooks receive two parameters: 1) A params object that may contain other objects that pertain to the particular hook. 2) A "bre" or BuidlerRuntimeEnvironment object that contains environment objects like web3, Truffle artifacts, etc.

// Called before a dao is deployed.
preDao: async ({ log }, { web3, artifacts }) => {},

// Called after a dao is deployed.
postDao: async ({ dao, _experimentalAppInstaller, log }, { web3, artifacts }) => {},

// Called after the app's proxy is created, but before it's initialized.
preInit: async ({ proxy, _experimentalAppInstaller, log  }, { web3, artifacts }) => {},

// Called after the app's proxy is initialized.
postInit: async ({ proxy, _experimentalAppInstaller, log  }, { web3, artifacts }) => {},

// Called when the start task needs to know the app proxy's init parameters.
// Must return an array with the proxy's init parameters.
getInitParams: async ({ log }, { web3, artifacts }) => {
  return []
}

If you want an example of how to use these hooks, please see the plugin's own tests for an example project.

Structure

This boilerplate has the following structure:

root
β”œβ”€β”€ app
β”œ β”œβ”€β”€ src
β”œ └── package.json
β”œβ”€β”€ contracts
β”œ └── CounterApp.sol
β”œβ”€β”€ test
β”œβ”€β”€ arapp.json
β”œβ”€β”€ manifest.json
β”œβ”€β”€ buidler.config.js
└── package.json
  • app: Frontend folder. Completely encapsulated: has its own package.json and dependencies.
    • src: Source files.
    • package.json: Frontend npm configuration file.
  • contracts: Smart contracts folder.
    • CounterApp.sol: AragonApp contract example.
  • test: Tests folder.
  • arapp.json: Aragon configuration file. Includes Aragon-specific metadata for your app.
  • manifest.json: Aragon configuration file. Includes web-specific configuration.
  • buidler.config.js: Buidler configuration file.
  • package.json: Main npm configuration file.

Libraries

aragon-react-boilerplate's People

Contributors

0xgabi avatar ahmetcetin avatar bingen avatar bpierre avatar cslarson avatar dependabot[bot] avatar evalir avatar izqui avatar jtremback avatar kernelwhisperer avatar macor161 avatar onbjerg avatar pythonpete32 avatar sembrestels avatar sohkai avatar theethernaut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aragon-react-boilerplate's Issues

Add front-end test pipeline

Add a way to run tests for the front-end, too. This is a bit of a hassle, since Truffle decided to roll their own version of Mocha with some things injected.

Add build pipeline

Add a build pipeline to transform React into something runnable in the browser.

Connection error

Following the directions in the Readme, and with Metamask switch to rpc http://localhost:8545, the app loads up and displays Organization not found. Looking in the dev console, there is a connection error:

WebSocket connection to 'ws://localhost:7545/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Use @aragon/client

When node-aragon is split into two, we should only depend on the client part, not the wrapper part.

/usr/bin/env: β€˜node --no-deprecation’: No such file or directory

$ npm start

> [email protected] start /home/porton/t/aragon-react-boilerplate
> npm run start:ipfs


> [email protected] start:ipfs /home/porton/t/aragon-react-boilerplate
> aragon run --files dist

/usr/bin/env: β€˜node --no-deprecation’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] start:ipfs: `aragon run --files dist`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] start:ipfs script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/porton/.npm/_logs/2019-12-22T20_23_49_509Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm run start:ipfs`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/porton/.npm/_logs/2019-12-22T20_23_49_518Z-debug.lo

Incorrect contract name in migration file

Looks like there is an incorrect contract name in ./migrations/2_deploy_contracts.js:1.

This is what it currently shows:

var App = artifacts.require('./App.sol')

But it should be this should be this:

var App = artifacts.require('./CounterApp.sol')

Fix tests

Currently when running test we are using the script @aragon/test-helpers/ganache-cli.sh

The error displayed is:

Could not connect to your Ethereum client. Please check that your Ethereum client:
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle.js)

React error when importing aragonUI components

Hi, importing several aragonUI components into App.js per the docs produces the following error:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `App`.
    in App
    in AragonApi

Error on: Header, Box, Bar, ...
No error: Button, Table, ...

Steps to Reproduce

  1. clone repo
  2. npm install
  3. npm run prepare
  4. npm run start:app
  5. npm run start:http
  6. Add aragonUI component Box to App.js:
// App.js

import React from 'react'
import { Main, Button, Box } from '@aragon/ui'
...

function App() {
  return (
    <Main>
      <Box>Primary content</Box>
      ...
    </Main>
  )
}
...

Is there a step that's missing when importing components?

app: copy-files should be used with `-u 1`

Currently the sync-assets script copies the files over to dist/public/meta but what we actually want (a the paths in manifest.json are currently written) is dist/meta.

IPFS error: no link named "index.html"

Hi,

I have encountered a problem while trying to run the boilerplate.

I have followed the instructions in the readme, and the DAO starts properly, but the Counter interface does not load. Instead, the following error message is shown:

ipfs resolve -r /ipfs/QmbDVxipAuZaBjek9JTgcVExTvcnVx9KosEn9iMAwRcMdK/index.html: no link named "index.html" under QmbDVxipAuZaBjek9JTgcVExTvcnVx9KosEn9iMAwRcMdK

Transactions are ignored (Bug in aragonOS?!)

After I increment the counter it remains 42, as if I did nothing.

Yes, I cleared the application cache.

I checked, that the value of the variable in contract remains the same (does not change).

Bug report for the commit 3cfd17acae7869addcbe35c5208baafc724d3a92.

Merge with aragon-react-kit-boilerplate

It doesn't really make sense for both of these boilerplates to exist, now that the CLI's kit functionality has been around for quite a while.

@0x6431346e @0xGabi What do you think about moving the kit implementation into this boilerplate and then archiving the other boilerplate?

Error running npm start

> aragon run

 βœ” Start a local Ethereum network
 βœ” Check IPFS
 βœ” Create DAO
 βœ” Initializing DAO permissions
 ❯ Publish APM package
   βœ” Deploy contract
   ↓ Automatically bump version [skipped]
     β†’ Starting from initial version
   βœ” Determine contract address for version
   βœ” Building frontend
   βœ” Prepare files for publishing
   βœ” Generate application artifact
   βœ– Publish foo.aragonpm.test
     β†’ Error: Repository foo.aragonpm.test does not exist and it's registry does not exist
   Install app
   Open DAO
 βœ– Error: Repository foo.aragonpm.test does not exist and it's registry does not exist

Ability to remove files from IPFS or stop propagating

Hi ,

If Is there a possibility to remove files from ipfs, after I made publishing + propagating?

aragon apm publish major "--environment" "staging"
npx aragon ipfs propagate <hash>

I noticed that the garbage collector didn't remove them, after 48 hrs.

Or maybe there is some way to update files using the same hash?
Thanks.

Build Error

After I installed aragon-cli, ran npm install. Then npm run start:app to start the app & npm run start:aragon:http I get the following error

/home/0mkar/.aragon/wrapper-fcebf55d1af6c574a92587e2a1d3ac8c00804d16/src/index.html: Conflicting babel versions found in .babelrc. Make sure all of your plugins and presets depend on the same major version of babel.

    at inferBabelVersion (/home/0mkar/.aragon/wrapper-fcebf55d1af6c574a92587e2a1d3ac8c00804d16/node_modules/parcel-bundler/src/transforms/babel/babelrc.js:224:17)
    at getBabelVersion (/home/0mkar/.aragon/wrapper-fcebf55d1af6c574a92587e2a1d3ac8c00804d16/node_modules/parcel-bundler/src/transforms/babel/babelrc.js:173:24)
    at 

Explain directory structure

At least one developer was confused or unaware of how the directory structure works (e.g. the frontend is completely encapsulated and has its own package.json and dependencies).

`npm start` does not work

vporton/courts@3465d94

npm start
...
Compiled 87 contracts successfully
backend  | Contracts compiled.
backend  | Started a ganache testnet instance with id 1590072386592.
backend  | Deploying Aragon bases (ENS, DAOFactory, and APM)...
backend  | ENS deployed: 0x5f6F7E8cc7346a11ca2dEf8f827b7a0b612c56a1
backend  | DAO factory deployed: 0x8EEaea23686c319133a7cC110b840d1591d9AeE0
backend  | APM deployed: 0xA53dE0b8e08b798f975D57f48384C177D410d170
backend  | Deploying DAO and app repository...
backend  | DAO deployed: 0x0D13999edC23D3475Ed3FE22a15Cc7828FeCD762
backend  | Creating app...
backend  | Proxy address: 0xA1A7d254552BEB05f15522EeD93B54441E61d1d9
backend  | Repo address: 0xAaFe10d42Afa9cAf22AEA3E853afD6EB279B6544
backend  | Proxy init params: 42
backend  | Implementation address: 0xbcE9e0203B700f9382C66405Dc5b4687E2e5F0A0
backend  | App version: 1,0,0
backend  | Initializing proxy...
An unexpected error occurred:

Error: Invalid number of parameters for "initialize". Got 1 expected 0!    at PromiEvent (/home/porton/Projects/courts/node_modules/@nomiclabs/truffle-contract/lib/promievent.js:13:30)
    at TruffleContract.initialize (/home/porton/Projects/courts/node_modules/@nomiclabs/truffle-contract/lib/execute.js:169:26)
    at Object.startBackend (/home/porton/Projects/courts/node_modules/@aragon/buidler-aragon/src/tasks/start/start-backend.ts:130:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at SimpleTaskDefinition.action (/home/porton/Projects/courts/node_modules/@aragon/buidler-aragon/src/tasks/start-task.ts:68:11)
    at Environment._runTaskDefinition (/home/porton/Projects/courts/node_modules/@nomiclabs/buidler/src/internal/core/runtime-environment.ts:196:14)
    at main (/home/porton/Projects/courts/node_modules/@nomiclabs/buidler/src/internal/cli/cli.ts:151:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @porton/[email protected] start: `buidler start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @porton/[email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/porton/.npm/_logs/2020-05-21T14_46_30_962Z-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.