Environment Set Up
A Look Ahead
In this section, we will cover:
- How to set up an environment for OHDF mapper development via:
Overview
The rest of this course will involve a mix of hands-on guided and unguided labs to teach you the basics of the technical implementation of OHDF mappers. To facilitate this, we provide two installation guides for setting up the environment necessary for these upcoming labs: A GitHub Codespaces environment set up (recommended for beginners) and a local environment set up (recommended for experienced developers or individuals interested in manually installing to their local system).
GitHub Codespaces Environment Set Up
We provide a GitHub Codespaces environment that includes a simple build script that installs the necessary repositories and packages to begin OHDF mapper development.
Follow the instructions listed in the README and you should have a verified working environment with the Heimdall and SAF CLI repositories pulled down into the /dev_repos/ directory. Heimdall can be found under /dev_repos/heimdall2/, the SAF CLI can be found under /dev_repos/saf/, and OHDF Converters can be found under /dev_repos/heimdall2/libs/hdf-converters/.
Local Environment Set Up
To set up the environment locally, we will need to pull down the GitHub repositories for Heimdall and the SAF CLI using Git and install their necessary dependencies using a package manager.
You can install Git here. Choose your OS and follow the installation guide as necessary.
Node.js (a runtime environment for JavaScript), NPM (a package manager for JavaScript/TypeScript), and Yarn (another package manager for JavaScript/TypeScript) are external utilities which are utilized extensively within this guide. The following section details their installation process.
Runtime & Package Managers
Linux/Mac OS
- Install nvm.
1a. Use either of the following commands to install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bashwget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash1b. Either restart the terminal or run the following commands to use nvm:
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- Run the following command to install and use Node.js v18:
nvm install 18- Install Yarn
Windows
Install Node.js v18 via the installer.
Install Yarn:
Repository Set Up
Now that we have the runtime and package managers for Javascript installed, we can pull down the necessary GitHub repositories and install their dependencies.
Fork/branch a development repository from the main Heimdall2 GitHub repository.
- SAF team developers have write access to the main repository and should create a branch on the primary development repository. Non-SAF team developers should instead create a fork of the main repository and create a development branch there.
Pull down your development branch from GitHub using the following command:
git clone {URL-TO-REPO-HERE}Create a draft pull request for your development branch against the main repository branch.
Install the necessary dependencies for Heimdall2. Under the
heimdall2directory, enter the following command in the terminal:
yarn install --frozen-lockfileFork/branch a development repository from the main SAF CLI GitHub repository.
- SAF team developers have write access to the main repository and should create a branch on the primary development repository. Non-SAF team developers should instead create a fork of the main repository and create a development branch there.
Pull down your development branch from GitHub using the following command:
git clone {URL-TO-REPO-HERE}Create a draft pull request for your development branch against the main repository branch.
Install the necessary dependencies for the SAF CLI. Under the
safdirectory, enter the following command in the terminal:
npm installYou should now have a working environment with the Heimdall and SAF CLI repositories. Heimdall can be found under /heimdall2/, the SAF CLI can be found under /saf/, and OHDF Converters can be found under /heimdall2/libs/hdf-converters/.
A Look Back
In this section, we covered:
- How to set up an environment for OHDF mapper development via: