mirror of
https://github.com/PaulRBerg/hardhat-template.git
synced 2026-01-09 14:07:58 -05:00
build: switch to bun for dep management
This commit is contained in:
@@ -15,6 +15,7 @@ types
|
||||
*.log
|
||||
.DS_Store
|
||||
.pnp.*
|
||||
bun.lockb
|
||||
coverage.json
|
||||
package-lock.json
|
||||
pnpm-lock.yaml
|
||||
|
||||
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
@@ -3,16 +3,17 @@ name: "CI"
|
||||
env:
|
||||
HARDHAT_VAR_MNEMONIC: "test test test test test test test test test test test junk"
|
||||
HARDHAT_VAR_INFURA_API_KEY: "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
|
||||
# Uncomment the following lines to set your configuration variables using
|
||||
# GitHub secrets (https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions)
|
||||
# HARDHAT_VAR_MNEMONIC: ${{ secrets.Mnemonic }}
|
||||
# HARDHAT_VAR_INFURA_API_KEY: ${{ secrets.InfuraApiKey }}
|
||||
# HARDHAT_VAR_ARBISCAN_API_KEY: ${{ secrets.ArbiscanApiKey }}
|
||||
# HARDHAT_VAR_BSCSCAN_API_KEY: ${{ secrets.BscscanApiKey }}
|
||||
# HARDHAT_VAR_ETHERSCAN_API_KEY: ${{ secrets.EtherscanApiKey }}
|
||||
# HARDHAT_VAR_OPTIMISM_API_KEY: ${{ secrets.OptimismApiKey }}
|
||||
# HARDHAT_VAR_POLYGONSCAN_API_KEY: ${{ secrets.PolygonscanApiKey }}
|
||||
# HARDHAT_VAR_SNOWTRACE_API_KEY: ${{ secrets.SnowtraceApiKey }}
|
||||
# Uncomment the following lines to set your configuration variables using
|
||||
# GitHub secrets (https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions)
|
||||
#
|
||||
# HARDHAT_VAR_MNEMONIC: ${{ secrets.Mnemonic }}
|
||||
# HARDHAT_VAR_INFURA_API_KEY: ${{ secrets.InfuraApiKey }}
|
||||
# HARDHAT_VAR_ARBISCAN_API_KEY: ${{ secrets.ArbiscanApiKey }}
|
||||
# HARDHAT_VAR_BSCSCAN_API_KEY: ${{ secrets.BscscanApiKey }}
|
||||
# HARDHAT_VAR_ETHERSCAN_API_KEY: ${{ secrets.EtherscanApiKey }}
|
||||
# HARDHAT_VAR_OPTIMISM_API_KEY: ${{ secrets.OptimismApiKey }}
|
||||
# HARDHAT_VAR_POLYGONSCAN_API_KEY: ${{ secrets.PolygonscanApiKey }}
|
||||
# HARDHAT_VAR_SNOWTRACE_API_KEY: ${{ secrets.SnowtraceApiKey }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -28,22 +29,19 @@ jobs:
|
||||
- name: "Check out the repo"
|
||||
uses: "actions/checkout@v3"
|
||||
|
||||
- name: "Install Pnpm"
|
||||
uses: "pnpm/action-setup@v2"
|
||||
with:
|
||||
version: "8"
|
||||
|
||||
- name: "Install Node.js"
|
||||
uses: "actions/setup-node@v3"
|
||||
with:
|
||||
cache: "pnpm"
|
||||
node-version: "lts/*"
|
||||
|
||||
- name: "Install Bun"
|
||||
uses: "oven-sh/setup-bun@v1"
|
||||
|
||||
- name: "Install the dependencies"
|
||||
run: "pnpm install"
|
||||
run: "bun install"
|
||||
|
||||
- name: "Lint the code"
|
||||
run: "pnpm lint"
|
||||
run: "bun run lint"
|
||||
|
||||
- name: "Add lint summary"
|
||||
run: |
|
||||
@@ -51,10 +49,10 @@ jobs:
|
||||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: "Compile the contracts and generate the TypeChain bindings"
|
||||
run: "pnpm typechain"
|
||||
run: "bun run typechain"
|
||||
|
||||
- name: "Test the contracts and generate the coverage report"
|
||||
run: "pnpm coverage"
|
||||
run: "bun run coverage"
|
||||
|
||||
- name: "Add test summary"
|
||||
run: |
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -18,4 +18,5 @@ deployments
|
||||
.pnp.*
|
||||
coverage.json
|
||||
package-lock.json
|
||||
pnpm-lock.yaml
|
||||
yarn.lock
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
image: "gitpod/workspace-node:latest"
|
||||
image: "gitpod/workspace-bun:latest"
|
||||
|
||||
tasks:
|
||||
- init: "pnpm install"
|
||||
- init: "bun install"
|
||||
|
||||
vscode:
|
||||
extensions:
|
||||
|
||||
@@ -15,6 +15,7 @@ types
|
||||
*.log
|
||||
.DS_Store
|
||||
.pnp.*
|
||||
bun.lockb
|
||||
coverage.json
|
||||
package-lock.json
|
||||
pnpm-lock.yaml
|
||||
|
||||
32
README.md
32
README.md
@@ -72,18 +72,18 @@ You can edit the CI script in [.github/workflows/ci.yml](./.github/workflows/ci.
|
||||
First, you need to install the dependencies:
|
||||
|
||||
```sh
|
||||
$ pnpm install
|
||||
$ bun install
|
||||
```
|
||||
|
||||
Then, you need to set up all the required
|
||||
[Hardhat Configuration Variables](https://hardhat.org/hardhat-runner/docs/guides/configuration-variables). You might
|
||||
also want to install some that are optional.
|
||||
|
||||
To assist with the setup process, run `pnpm dlx hardhat vars setup`. To set a particular value, such as a BIP-39
|
||||
mnemonic variable, execute this:
|
||||
To assist with the setup process, run `bunx hardhat vars setup`. To set a particular value, such as a BIP-39 mnemonic
|
||||
variable, execute this:
|
||||
|
||||
```sh
|
||||
$ pnpm dlx hardhat vars set MNEMONIC
|
||||
$ bunx hardhat vars set MNEMONIC
|
||||
? Enter value: ‣ here is where your twelve words mnemonic should be put my friend
|
||||
```
|
||||
|
||||
@@ -94,7 +94,7 @@ If you do not already have a mnemonic, you can generate one using this [website]
|
||||
Compile the smart contracts with Hardhat:
|
||||
|
||||
```sh
|
||||
$ pnpm compile
|
||||
$ bun run compile
|
||||
```
|
||||
|
||||
### TypeChain
|
||||
@@ -102,7 +102,7 @@ $ pnpm compile
|
||||
Compile the smart contracts and generate TypeChain bindings:
|
||||
|
||||
```sh
|
||||
$ pnpm typechain
|
||||
$ bun run typechain
|
||||
```
|
||||
|
||||
### Test
|
||||
@@ -110,7 +110,7 @@ $ pnpm typechain
|
||||
Run the tests with Hardhat:
|
||||
|
||||
```sh
|
||||
$ pnpm test
|
||||
$ bun run test
|
||||
```
|
||||
|
||||
### Lint Solidity
|
||||
@@ -118,7 +118,7 @@ $ pnpm test
|
||||
Lint the Solidity code:
|
||||
|
||||
```sh
|
||||
$ pnpm lint:sol
|
||||
$ bun run lint:sol
|
||||
```
|
||||
|
||||
### Lint TypeScript
|
||||
@@ -126,7 +126,7 @@ $ pnpm lint:sol
|
||||
Lint the TypeScript code:
|
||||
|
||||
```sh
|
||||
$ pnpm lint:ts
|
||||
$ bun run lint:ts
|
||||
```
|
||||
|
||||
### Coverage
|
||||
@@ -134,7 +134,7 @@ $ pnpm lint:ts
|
||||
Generate the code coverage report:
|
||||
|
||||
```sh
|
||||
$ pnpm coverage
|
||||
$ bun run coverage
|
||||
```
|
||||
|
||||
### Report Gas
|
||||
@@ -142,7 +142,7 @@ $ pnpm coverage
|
||||
See the gas usage per unit test and average gas per method call:
|
||||
|
||||
```sh
|
||||
$ REPORT_GAS=true pnpm test
|
||||
$ REPORT_GAS=true bun run test
|
||||
```
|
||||
|
||||
### Clean
|
||||
@@ -150,7 +150,7 @@ $ REPORT_GAS=true pnpm test
|
||||
Delete the smart contract artifacts, the coverage reports and the Hardhat cache:
|
||||
|
||||
```sh
|
||||
$ pnpm clean
|
||||
$ bun run clean
|
||||
```
|
||||
|
||||
### Deploy
|
||||
@@ -158,7 +158,7 @@ $ pnpm clean
|
||||
Deploy the contracts to Hardhat Network:
|
||||
|
||||
```sh
|
||||
$ pnpm deploy:contracts
|
||||
$ bun run deploy:contracts
|
||||
```
|
||||
|
||||
### Tasks
|
||||
@@ -168,11 +168,9 @@ $ pnpm deploy:contracts
|
||||
Deploy a new instance of the Lock contract via a task:
|
||||
|
||||
```sh
|
||||
$ pnpm task:deployLock --unlock 100 --value 0.1
|
||||
$ bun run task:deployLock --unlock 100 --value 0.1
|
||||
```
|
||||
|
||||
## Tips
|
||||
|
||||
### Syntax Highlighting
|
||||
|
||||
If you use VSCode, you can get Solidity syntax highlighting with the
|
||||
@@ -182,7 +180,7 @@ If you use VSCode, you can get Solidity syntax highlighting with the
|
||||
|
||||
[GitPod](https://www.gitpod.io/) is an open-source developer platform for remote development.
|
||||
|
||||
To view the coverage report generated by `pnpm coverage`, just click `Go Live` from the status bar to turn the server
|
||||
To view the coverage report generated by `bun run coverage`, just click `Go Live` from the status bar to turn the server
|
||||
on/off.
|
||||
|
||||
## Local development with Ganache
|
||||
|
||||
@@ -61,14 +61,14 @@
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf ./artifacts ./cache ./coverage ./types ./coverage.json && pnpm typechain",
|
||||
"clean": "rimraf ./artifacts ./cache ./coverage ./types ./coverage.json && bun run typechain",
|
||||
"compile": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat compile",
|
||||
"coverage": "hardhat coverage --solcoverjs ./.solcover.js --temp artifacts --testfiles \"test/**/*.ts\" && pnpm typechain",
|
||||
"coverage": "hardhat coverage --solcoverjs ./.solcover.js --temp artifacts --testfiles \"test/**/*.ts\" && bun run typechain",
|
||||
"deploy:contracts": "hardhat deploy",
|
||||
"lint": "pnpm lint:sol && pnpm lint:ts && pnpm prettier:check",
|
||||
"lint": "bun run lint:sol && bun run lint:ts && bun run prettier:check",
|
||||
"lint:sol": "solhint --max-warnings 0 \"contracts/**/*.sol\"",
|
||||
"lint:ts": "eslint --ignore-path ./.eslintignore --ext .js,.ts .",
|
||||
"postcompile": "pnpm typechain",
|
||||
"postcompile": "bun run typechain",
|
||||
"prettier:check": "prettier --check \"**/*.{js,json,md,sol,ts,yml}\"",
|
||||
"prettier:write": "prettier --write \"**/*.{js,json,md,sol,ts,yml}\"",
|
||||
"task:deployLock": "hardhat task:deployLock",
|
||||
|
||||
6484
pnpm-lock.yaml
generated
6484
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user