First, make sure you have the ethereum-tests
git submodule, by running:
git submodule init
git submodule update
This monorepo uses npm workspaces. It links the local packages together, making development a lot easier.
TLDR: Setup
npm i
TLDR: To update dependencies
npm run build --workspaces
Above is the quickest way to set you up.
Windows users might run into the following error when trying to install the repo: '.' is not recognized as an internal or external command
. To remediate for this, you can force Windows to use Git bash to run scripts (you'll need to install Git for Windows for this) with the following command:
npm config set script-shell "C:\\Program Files (x86)\\git\\bin\\bash.exe"
If you ever need to reset this change, you can do so with this command:
npm config delete script-shell
Going down the road, there are two sets of commands: project and package-specific commands. You can find them at ./package.json
and ./packages/*/package.json
, respectively. Here's a breakdown:
Adds dependencies listed in the root package.
Builds all monorepo packages.
To build a specific package, use npm run build --workspace=@ethereumjs/vm
Removes root and packages node_modules
directories, and other generated files, like coverage
, dist
and others. This is useful to run after changing branches, to have a clean slate to work with.
These scripts execute lint
and lint:fix
respectively, to all monorepo packages. Worth noting that there is a git hook in place that runs npm run lint
for every git push
. This check can be skipped using git push [command] --no-verify
.
Rebuilds all generated docs.
npm install
from the package directory, it will ignore the workspace. Run npm install
from the root only.
There's a set of rather standardized commands you will find in each package of this repository.
Uses TypeScript compiler to build source files. The resulting files can be found at packages/<name>/dist
.
Runs whatever is on npm run test
script, capturing testing coverage information. By the end, it displays a coverage table. Additional reports can be found at packages/<name>/coverage/
.
Generates package documentation and saves them to ./packages/<name>/docs
.
Checks code style according to the eslint rules.
Fixes code style according to the rules. Differently from npm run lint
, this command actually writes to files.
Runs the package tests.
Run & watch a single test file. Vitest will run the specified test file each time code in the associated package is updated so useful for prototyping when you are working on a specific issue/test case.
Note that the VM has several test scopes - refer to packages/vm/package.json for more info.