An iteration of the Colony Dapp sporting both a fully decentralized operating mode, as well as a mode enhanced by a metadata caching layer.
node
v20.11.x
(Best use nvm)npm
v10.x
(At least. The newer, the better)docker
v19.03.0+
(See install instructions)
First, clone this repository :)
Pick the right node version (as seen in .nvmrc
):
nvm use
Install all dependencies:
npm install
Note: at the end of the install there's a post-install script that will recursively install dependencies for all the currently declared lambda functions
On Linux, you'll need to run the following commands to increase the default limit of watched files. Otherwise, the watchAmplifyFiles
script will not work properly.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
npm run dev
This will build your local docker images, then attempt to start them _(the local dev environment runs inside a couple of docker containers).
On the next start, assuming no key cache files changed, it will skip the image building step (as it will just used the cached version), and go straight to starting your environment.
Once the above dev environment is up and running, you need to start your dev web server:
npm run frontend
You can access it at http://localhost:9091
(notice the different port, as to not cause a local storage and cache conflict with the Dapp)
You can access the Amplify / Mock Appsync GraphQL api playground at http://localhost:20002
In order for reputation to function within your dev environment, you will need to toggle it on first.
Access the following URL to toggle the reputation monitor auto-mining on or off: http://127.0.0.1:3001/reputation/monitor/toggle
You can also view the status of the reputation monitor using the following URL: http://127.0.0.1:3001/reputation/monitor/status
If needed, the truffle console is available to you via:
npm run truffle
NOTE: This only works while the environment is running
If you want to build the bundle locally for production, you can do it via:
npm run build
Note: It's a straight-up dev build. Just bundled, no code optimizations whatsoever.
Linting your code via eslint
can be done as such:
npm run lint
To lint the project's style sheets you run:
npm run stylelint
Type checking using TypeScript can be accessed using this npm script:
npm run typecheck
# Or, with file watching (or any other `tsc optional arguments`)
npm run typecheck --watch
To run unit tests you have the following npm script:
npm run test
If using the Tailwind CSS IntelliSense plugin for VSCode, add the following to your .vscode/settings.json
file to add additional tooling where tailwind classes have been used with the custom tw
utility function:
// .vscode/settings.json
{
// ..
"tailwindCSS.experimental.classRegex": [
"tw`([^`]*)",
]
}
When upgrading colony-js
package, you usually want to do it for not just CDapp but also all the lambdas that depend on it. There's an upgrade-colony-js
script that does it for you:
npm run upgrade-colony-js <version>
Twemoji graphics made by Twitter and other contributors, licensed under CC-BY 4.0: https://creativecommons.org/licenses/by/4.0/