Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pradeep-selva/hardhat-nodemon
A Nodemon kind of experience with hardhat.
https://github.com/pradeep-selva/hardhat-nodemon
ethereum evm ganache hardhat hardhat-plugin hevm hound nodemon npm npm-package smart-contracts solidity typescript watch
Last synced: 2 days ago
JSON representation
A Nodemon kind of experience with hardhat.
- Host: GitHub
- URL: https://github.com/pradeep-selva/hardhat-nodemon
- Owner: Pradeep-selva
- License: mit
- Created: 2022-06-18T13:26:24.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-28T04:34:35.000Z (about 2 years ago)
- Last Synced: 2024-11-06T00:55:14.967Z (3 days ago)
- Topics: ethereum, evm, ganache, hardhat, hardhat-plugin, hevm, hound, nodemon, npm, npm-package, smart-contracts, solidity, typescript, watch
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/hardhat-nodemon
- Size: 557 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Hardhat Nodemon
A Nodemon kind of experience with hardhat.
This is a hardhat plugin that aims at providing a hassle free experience with hardhat, where you can run compile / test once, and watch for changes to recompile automatically, eliminating the manual recompilation / retesting workflow.
---
## Demo
![demo](https://raw.githubusercontent.com/Pradeep-selva/hardhat-nodemon/master/demo.gif?token=GHSAT0AAAAAABJORISFY2HIOY4N7RW4G7XWYVOOOIQ)
---
## Installation
1. To install via npm, use --
`npm i --save-dev hardhat-nodemon`
(or)
`yarn add -D hardhat-nodemon`
2. To run locally,
- Clone repo
- Run `yarn`
- Run `npm link`
- Run `npm link hardhat-nodemon` wherever you wish to use**NOTE: This requires at least Node Version >= 14.17.0**
## Usage
After installation, add the following line to your `hardhat.config.ts` --
```
import "hardhat-nodemon";
```in order to extend hardhat with this plugin.
## Features
1. **Compile:**
- A flag `--watch` is provided to `compile` to watch for contract changes to re-compile.
- 2 additional helper options are also provided --**only:**
- This accepts a string of contract names, separated by comma (,)
- Only these contracts are watched for compilation- eg: `npx hardhat compile watch --only "Sample.sol, Sample2.sol"`
**except:**
- This accepts a string of contract names, separated by comma (,)
- Only these contracts are not watched for compilation- eg: `npx hardhat compile watch --except "Sample.sol, Sample2.sol"`
- Run `npx hardhat compile --help` for more details.
```
npx hardhat compile --help
Hardhat version 2.9.1Usage: hardhat [GLOBAL OPTIONS] compile [--except ] [--force] [--no-size-contracts] [--no-typechain] [--only ] [--quiet] [--watch]
OPTIONS:
--except A list of contracts to ignore while watching for compilation, separated by commas (.sol files) (default: "")
--force Force compilation ignoring cache
--no-typechain Skip Typechain compilation
--only A list of contracts to watch for compilation, separated by commas (.sol files) (default: "")
--quiet Makes the compilation process less verbose
--watch Watch changes in contract filescompile: Compiles the entire project, building all artifacts
For global options help run: hardhat help
```2. **Test:**
- A flag `--watch` is provided to `test` to watch for tests / contracts changes to re-compile.
- It inherits all features of the base `test` but extends it with watching capabilities for both test files and solidity contracts.- Run `npx hardhat test --help` for more details.
```
npx hardhat test --help
Hardhat version 2.9.1Usage: hardhat [GLOBAL OPTIONS] test [--bail] --grep [--no-compile] [--parallel] [--watch] [...testFiles]
OPTIONS:
--bail Stop running tests after the first test failure
--grep Only run tests matching the given string or regexp
--no-compile Don't compile before running this task
--parallel Run tests in parallel
--watch Watch changes in files used in test (from testDir of config)POSITIONAL ARGUMENTS:
testFiles An optional list of files to test (default: [])
test: Runs mocha tests
For global options help run: hardhat help
```3. **Extended Config:**
- `hardhat.config.ts` accepts a config of `compilerWatcher` which takes --
```js
{
noCompile?: boolean;
compileDir?: string;
testDir?: string;
}
```- By default the values are --
```js
{
noCompile: false;
compileDir: "contracts";
testDir: "test";
}
```- This can mainly be used to define compilation flow at start, directory where contracts are stored and directory where tests are stored.
## License
[MIT](./LICENSE)