How to Provision a New Computer for Cantilever Dev Work

Core team members will receive a machine to use for Cantilever work, and it should be set up according to this guide. When contributors onboard, they should set up their existing computer for Cantilever work as well. For Contributors we recommend setting up a new user account to work on Cantilever stuff so that our tools don’t interrupt those you may have installed for other clients.

We are a Mac shop outside of specific testing machines. Regrettably we can’t support PCs in our dev ecosystem.

Most of our software is free to download and you will receive accounts during onboarding. Some tools may require individual payment/licenses. When that is the case, please

.

Software to Install

  • Homebrew. Install this first, it makes installing everything else easier.
  • Node
  • NPM
  • Git. If you installed Xcode, you will have git automatically, but you may want a more recent version for some of the QOL updates they’ve added over the years.
  • Composer, installed globally. You should be able to type "composer install" rather than `php ./composer.phar`, for instance.
  • NVM. For managing and installing Node versions.
  • jq installed globally - brew install jq
  • 1Pasword CLI - brew install --cask 1password/tap/1password-cli
  • Lando - Download the latest version of Lando and install
  • Visual Studio Code

Additional Setup

Connect 1Password CLI to the app

See guide for detailed instructions.

image

SSH Keys

If you are touching code, you will need an SSH key: help.github.com/articles/generating-a-new-ssh...

Once you generate a key, you will need it added to the client server for each project you work on. Our projects are on a mix of PaaS platforms and standalone servers (typically on Digital Ocean). For those servers, please ask @Andrew Heins to add your key to the relevant place.

If you migrate to a new machine, we highly suggest copying over your existing SSH key rather than setting up a new one. Use this guide: osxdaily.com/2012/07/13/move-ssh-keys-from...

Automatic Node Version Switching

Projects often times require a specific version of node to run properly. Node versions can be easily managed with the use of NVM. Once NVM is installed you can switch node versions by using the nvm command, for example nvm use 16 will load node v16 into your current shell.

Taking this a step further we can create a .nvmrc in the root of our projects and inside the contents of the file is simply the node version you want to use for that project. For example v18.16.0. Then a developer can simply run the nvm use command to source the correct node version.

A script can be added to your zsh profile which will automatically check to see if there is a .nvmrc file in your current directory and switch to the correct node version. To add this script follow these steps:

  1. In a terminal window run nano ~/.zshrc
  2. At the end of the file add the following:
autoload -U add-zsh-hook
load-nvmrc() {
  local node_version="$(nvm version)"
  local nvmrc_path="$(nvm_find_nvmrc)"

  if [ -n "$nvmrc_path" ]; then
    local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")

    if [ "$nvmrc_node_version" = "N/A" ]; then
      nvm install
    elif [ "$nvmrc_node_version" != "$node_version" ]; then
      nvm use
    fi
  elif [ "$node_version" != "$(nvm version default)" ]; then
    echo "Reverting to nvm default version"
    nvm use default
  fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc

Visual Studio Code Plugins