You can install Node.js using nvm. After following the installation instructions, run the following commands to install and use Node.js 22.x:
nvm install 22
nvm use # run from the root of the project
If Yarn is not already installed, you can install it using npm:
npm install --global yarn
If working on contracts, install Foundry following its installation instructions.
After the prerequisites are installed, install all package and development dependencies using Yarn:
yarn # run from the root of the project
In a Yarn Workspaces monorepo,
the root package.json
file contains a list of workspaces, each of which is
it's own package with it's own package.json
file.
You can work with the root package.json
mostly like you would with any other:
yarn <script-name>
# use the -W flag when installing root dependencies
yarn -W add <package-name>
To target a specific package, use the workspace
command:
yarn workspace <package-name> <script-name>
yarn workspace <package-name> add <package-name>
Many of the tests in this repo require access to an RPC node to run. The RPC
endpoints are defined in the .env
files in each package. Create them using the
.env.example
files as a template and fill in the required values. You can
either point to an external RPC API like Alchemy, or
to a local node like anvil
.
Once the .env
files are set up, tests can be run using the test
scripts:
# run all tests
yarn test
# run tests for a specific package (usually preferred to avoid nonce issues)
yarn workspace <package-name> test
Use lower-hyphen-case in the following format for branch names:
<user-alias>/[commit-type/]<title>
user-alias
: Your GitHub username or alias.commit-type
: The type of change you're making.feat
: A new feature or improvement.fix
: A patch for a bug.chore
: A maintenance task, non-critical change, or documentation update.
title
: A short label/description of the change.
Examples:
ryangoree/feat/epoch-block
ryangoree/fix/overloaded-calls
ryangoree/chore/fix-comment-typo
ryangoree/chore/update-readme-examples
This repo uses changesets to manage versioning and changelogs. This means you shouldn't need to manually change any of the internal package versions.
Before opening a PR, run:
yarn changeset
Follow the prompts to describe the changes you've made using the semver versioning scheme and commit the generated changeset file.
As changesets are committed to the main
branch, the changesets github
action in the release workflow will
automatically keep track of the pending package.json
and CHANGELOG.md
updates in an open PR titled chore: version packages
. Once this PR is merged,
the release workflow will be triggered, creating new tags and github releases,
and publishing the updated packages to NPM. These PRs should be carefully
reviewed!