TradeTrust / tradetrust-website

https://tradetrust.io
Apache License 2.0
17 stars 33 forks source link

TradeTrust Web UI

CI

See also:

Development

We develop primarily on a OS X / Linux environment so please lodge an issue if you are using Windows and find that you cannot successfully set up a local instance of this software.

OS X / Linux

npm install
npm run dev

Windows

For Windows you need to set up the toolchain for node-gyp before installing this repository, follow the instructions in https://github.com/nodejs/node-gyp#on-windows.

npm install
npm run dev

Environmental Variables

NET is used for setting the default network, setting it to mainnet uses the public Ethereum network. If it is not set it defaults to Sepolia testnet. It can also take any network names that Ethers.JS supports, such as sepolia, amoy, etc. However do note that there are only drag & drop demo files provided for main net and sepolia.

E.g:

NET=mainnet npm run dev

or

NET=sepolia npm run dev

Troubleshooting

To enable debug logs in the browser, set localStorage.debug="*"

Test single feature flag

To test, simply run the following in console and refresh the website:

localStorage.setItem("FEATURE_FLAG", JSON.stringify({ADDRESS_BOOK_UPLOAD: true}))

or

localStorage.FEATURE_FLAG =  JSON.stringify({ADDRESS_BOOK_UPLOAD: true})

Test all feature flags

localStorage.setItem("FEATURE_FLAG", JSON.stringify({ALL: true}))

or

localStorage.FEATURE_FLAG =  JSON.stringify({ALL: true})

Module build failed

If you see module build failure message like:

Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: ENOENT: no such file or directory, scandir 'D:\opencerts-website\node_modules\node-sass\vendor'
at Object.readdirSync (fs.js:783:3)

Try running npm rebuild

Generating CREDITS.md

npm run credits

Running single integration test (testcafe)

npm run integration:single <path>, for the path, you can copy paste relative path via text editor.

Running single integration test (synpress)

it("should import account 2 and connect all metamask wallets to dapp", () => {
   cy.importMetamaskAccount("0xc58c1ff75001afdca8cecb61b47f36964febe4188b8f7b26252286ecae5a8879").should("be.true");
   cy.switchMetamaskAccount(1).should("be.true");

   cy.connectWallet();
   cy.acceptMetamaskAccess(true).should("be.true");
 });

remove step 2 and 3 once test is done, and check all test cases passes before pushing to github

Managing Netlify CMS

Inviting users to Netlify CMS

Debugging Netlify CMS locally

https://www.netlifycms.org/docs/beta-features/#working-with-a-local-git-repository

  1. run npx netlify-cms-proxy-server
  2. run npm run dev
  3. access admin page by http://localhost:3000/imd@/