Setting up your local development environment

Gitlab

The required code can be downloaded from our gitlab repositories:

gitlab.com/hybrix-public

To download (clone) the code from gitlab please use:

git clone https://gitlab.com/hybrix-public/node.git

Enter the newly created folder

cd node

To setup and install development dependencies run:

./scripts/npm/setup.sh

This will also automatically clone several other repositories that are required. Once this is done an online connection is no longer needed for development. An overview of the folder structure that will be created follows:

Folder structure

The development environment expects all repositories to be cloned into a common base folder, you can choose any name. Here we will use $HYBRIXD as a placeholder ($ are shell variable prefixes)

Required

Optional

  • $HYBRIXD/web-wallet : contains everything required to compile the web-wallet module (required for front-end development)
  • $HYBRIXD/deterministic : contains everything required to compile deterministic client modules (required for determistic development) gitlab.com/hybrix-public/deterministic
  • $HYBRIXD/node : NodeJS run times for various architectures (independent setup) gitlab.com/hybrix-public/nodejs

Per project

  • $HYBRIXD/$PROJECT/dist : The compiled distributable files if applicable.
  • $HYBRIXD/$PROJECT/docs : Documentation
  • $HYBRIXD/$PROJECT/node_binaries : A link to $HYBRIXD/nodejs/$SYSTEM where $SYSTEM depends on your system architecture (Linux, Mac, 32 or 64 bit)
  • $HYBRIXD/$PROJECT/node_modules : The node modules needed for this project.
  • $HYBRIXD/$PROJECT/package.json : The npm package file.
  • $HYBRIXD/$PROJECT/common : A link to $HYBRIXD/common
  • $HYBRIXD/$PROJECT/scripts : tool scripts
  • $HYBRIXD/$PROJECT/scripts/npm : npm command scripts e.g npm run buildwill run HYBRIXD/$PROJECT/scripts/npm/build.sh

npm commands

npm (Node Package Manager) is used to manage the node packages per project (located in the $HYBRIXD/$PROJECT/node_modules folders) The configuration is stored in $HYBRIXD/$PROJECT/package.json

Important! Please do not use you global npm but the one located in $HYBRIXD/$PROJECT/node_binaries/bin/npm This ensures version compatibility.

The following commands can be used from the $HYBRIXD/$PROJECT project folders:

  • npm run setup : Run all tasks to setup the dev environment for this project. For example link dependencies and implement git hooks.
  • npm run compile : Run all tasks to compile the project into the $HYBRIXD/$PROJECT/dist distributables folder.
  • npm run dist : Distribute the compiled files to the Node
  • npm run clean : Clean the $HYBRIXD/$PROJECT/dist distributables folder.
  • npm run build : Run the setup, compile and dist commands sequentially.
  • npm run docs : Compile documentation.
  • npm run diag : Run a diagnostic on all project folders to check linkage and git status.
  • npm run lint : Run the linting on all project files that have been modified with respect to master branch.

Troubleshooting

  • Run npm run diag to validate all components and linkage.
  • Run npm run setup to correct linkage problems
  • Run npm run lint to identify linting problems

node

The following extra commands can be used from the $HYBRIXD/nodeproject folder:
  • npm run start : Start HYBRIXD (equivalent to ./HYBRIXD)
  • npm run cluster:start : Initialize and start a cluster of 2 local hybrixd nodes.
  • npm run cluster:start -- $N : Initialize and start a cluster of N local hybrixd nodes. (note the spaces)

web-wallet

The following extra commands can be used from the $HYBRIXD/web-wallet project folder:

  • npm run build:fast : Run all tasks to compile the views in the dist folder and migrate them to $HYBRIXD/node/modules/web-wallet