truffle-box / react-box

Truffle, Webpack and React boilerplate.
https://truffle-box.github.io/
MIT License
736 stars 251 forks source link

Web3 v1.0 #65

Closed adrianmcli closed 6 years ago

adrianmcli commented 6 years ago

This PR seeks to overhaul the Truffle box in many ways, read on to find out more.

Done

The following items have already been implemented in this PR.

Frontend client

Truffle project

How to test (i.e. try it out)

  1. Checkout the branch:

    git checkout web3-v1.0
  2. Run truffle develop and then run tests, compile, and migrate:

    truffle develop
    truffle(develop)> test
    truffle(develop)> compile
    truffle(develop)> migrate --reset
  3. In a new terminal, navigate to the client folder, install dependencies, and run the link contracts script:

    cd client
    npm install
    npm run link-contracts
  4. Start the frontend client with npm start.

  5. Make sure you are using a browser where MetaMask is disabled (we will add support for this later, see above) and navigate to http://locahost:3000 in your browser.

  6. Observe that the stored value is 5.

adrianmcli commented 6 years ago

@DiscRiskandBisque I've added a windows script for linking contracts: https://github.com/truffle-box/react-box/pull/65/files#diff-52dbbf94d5c54b68c0cad0702ba94a96R19

"script": {
  "link-contracts": "run-script-os",
  "link-contracts:linux:darwin": "cd src && ln -s ../../build/contracts contracts",
  "link-contracts:win32": "cd src && mklink \\D C:\\..\\build\\contracts contracts"
}

The run-script-os devDependency will run the right script depending on the machine's OS.

This PR is now ready to be merged.

adrianmcli commented 6 years ago

@DiscRiskandBisque

I'm using the following script for making a symlink on Windows, I grabbed it from your edit to my tutorial:

mklink \D C:\..\build\contracts contracts

But shouldn't it be a relative symlink instead? Something like:

mklink \D ..\..\build\contracts contracts

For reference, the linux version is:

ln -s ../../build/contracts contracts