Setting up your local development environment
Gitlab
The required code can be downloaded from our gitlab repositories:
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
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
$HYBRIXD/node
: contains the hybrixd deamon (required for all development) gitlab.com/hybrix-public/hybrixd$HYBRIXD/common
: files that are used by several of the above projects (required) gitlab.com/hybrix-public/common$HYBRIXD/node_modules
: the node_modules (required) gitlab.com/hybrix-public/node_modules$HYBRIXD/hybrix-jslib
: contains what is needed to compile the hybrix javascript interface client libraries (required) gitlab.com/hybrix-public/hybrix-jslib
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.gnpm run build
will runHYBRIXD/$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 Nodenpm 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/node
project 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 thedist
folder and migrate them to$HYBRIXD/node/modules/web-wallet