Installing sage requirements in trellis

I’m new to sage and trellis (and ansible/vagrant), but have been using bedrock for a few years.

The sage docs mention that Volta is recommended and it’s simple enough to install manually

# install volta
curl | bash

#manual prepend volta to path
# should this be done per session or in .bashrc?

# Install the latest Node.js LTS release
$ volta install node

# Globally install Yarn
$ npm install --global yarn

However, what’s the recommended way to include this into the trellis set up so that it gets set up automatically when deploying? I assume that this should be done through ansible. Is the build-before.yml the best place for this?

Sage uses Volta, Node, etc to to build its styles, scripts, and templates (collectively called “artifacts”, stored in the public directory in your theme) at “build time” (when you run yarn build) but it doesn’t require these tools at “run time” (when you or a visitor view the site).

Trellis includes an optional script to build and transfer Sage’s artifacts when you deploy. You can modify it to match your settings, but that’s all you need to do; just built it locally and copy it to your web host.