Build command
To build the project:Build process
The build process executes the following steps:-
Clean previous builds
Removes the output directory and generated types to ensure a clean build.
-
Generate TypeScript types from ABIs
Uses TypeChain to generate TypeScript types from contract ABIs in the
abi/directory. -
Compile TypeScript
Compiles all TypeScript source files to JavaScript in the
dist/directory. -
Copy schema files
Copies the JSON schema file needed for runtime configuration validation.
TypeChain configuration
TypeChain generates type-safe contract interfaces:- Target: ethers-v5 (generates types compatible with ethers.js v5)
- Output:
src/types/generated/ - Input: All JSON files in the
abi/directory
Output directory
The build outputs to thedist/ directory:
Build artifacts
After building, the following artifacts are generated:- Compiled JavaScript: All
.tsfiles compiled to.jsindist/ - Type declarations:
.d.tsfiles for TypeScript consumers - Contract types: Generated TypeScript interfaces for smart contracts
- JSON schemas: Configuration validation schemas
Entry point
The main entry point is defined inpackage.json:
Prepare hook
The project includes a prepare hook that runs after installation:husky install- Sets up git hooksyarn typechain- Generates contract typesyarn configschema- Generates configuration schema
Building for production
For production deployments:- Run the full build:
yarn build - The
dist/directory contains the deployable application - Ensure all dependencies in
package.jsonare installed in production