This guide provides an overview of the monorepo, development tools used, shared configuration and additionally covers some advanced topics.
It is intended to be both an entrypoint for external contributors as well as a reference point for team members.
The EthereumJS project uses npm workspaces to manage all the packages in our monorepo and link packages together.
/packages
- Contains all EthereumJS packages/config
- Shared configuration files and scriptspackages/ethereum-tests
- Git submodule with Ethereum test vectorsThe ./config/cli
directory contains helper scripts referenced in package.json files:
coverage.sh
- Runs test coveragets-build.sh
- Builds TypeScript for productionts-compile.sh
- Compiles TypeScript for developmentnpm run clean
- Removes build artifacts and node_modulesnpm run lint
- Check code style with ESLint v9 and Biomenpm run lint:fix
- Automatically fix style issuesnpm run build --workspaces
- Build all packages in the monoreponpm run docs:build
- Generate documentation for all packagesTo focus on a single package (e.g., VM):
cd packages/vm
npm run test
npx vitest test/path/to/test.spec.ts
npm run build --workspace=@ethereumjs/vm
All packages include a typescript
entry in the exports map that allows direct use of TypeScript sources without recompilation:
npx vitest --config ../../config/vitest.config.mts test/myTest.spec.ts
tsx --conditions=typescript myScript.ts
NODE_OPTIONS='--conditions=typescript' (if running Node 22+)
Windows users might encounter errors with script paths. To fix, configure Git bash as the script shell:
npm config set script-shell "C:\\Program Files (x86)\\git\\bin\\bash.exe"
To reset this setting:
npm config delete script-shell
All packages use TypeScript with a shared base configuration.
Each package should have:
tsconfig.json
- For development and testingtsconfig.prod.json
- For building production releasesExample tsconfig.json
:
{
"extends": "../../config/tsconfig.json",
"include": ["src/**/*.ts", "test/**/*.ts"]
}
Example tsconfig.prod.json
:
{
"extends": "../../config/tsconfig.prod.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "./dist"
}
}
Use these commands in your package scripts:
{
"scripts": {
"tsc": "../../config/cli/ts-compile.sh",
"build": "../../config/cli/ts-build.sh"
}
}
We use ESLint v9 and Biome for code style enforcement and linting.
Each package includes:
eslint.config.mjs
- package specific ESLint configuration that extends the repository wide configCommands area available on both root and package levels.
Run npm run lint
to find lint issues and npm run lint:fix
to fix fixable lint issues.
We use cspell to do spellchecking.
The following two configuration files include a list of allowed words (add yours if you have one necessary) as well as some additional configuration, separate for docs and code.
config/cspell-md.json |
Markdown |
config/cspell-ts.json |
TypeScript |
Commands area available on both root and package levels.
{
"scripts": {
"sc": "npm run spellcheck",
"spellcheck": "npm run spellcheck:ts && npm run spellcheck:md",
"spellcheck:ts": "npx cspell --gitignore -c ../../config/cspell-ts.json ...",
"spellcheck:md": "npx cspell --gitignore -c ../../config/cspell-md.json ..."
}
}
The project uses Vitest for testing with c8 for code coverage.
Each package includes one or more test scripts. To run all tests in any package, use npm run test
. Refer to the package.json for more specifics.
To run a specific test and watch for changes:
npx vitest test/path/to/test.spec.ts
We use vitest
with playwright to run browser tests. When running browser tests with npm run test:browser
, ensure you have a version of the Chromium browser installed. If not, you can run npx playwright install --with-deps
to install a supported version.
To test packages with an external project locally, use npm link:
cd packages/package-name
npm run build
npm link
cd path/to/your/project
npm link @ethereumjs/package-name
When you make changes to your package, rebuild it for the changes to be reflected.
npm unlink –no-save @ethereumjs/package-name
npm unlink ```
When making changes to the linked package, rebuild it for the changes to be reflected in your test project.
Common development dependencies (e.g. eslint
, biome
) are defined in the root package.json
.
There are selected additional developer docs available to get more deep on certain topics. The following is an overview.
VM Docs for testing, debugging and VM/EVM profiling.
Client Docs for running Hive tests.