Commit 65a859de authored by Liam Horne's avatar Liam Horne Committed by GitHub

Check if Foundry is installed before building (#2777)

* build: add prebuild script to check for foundry installation

* fix: replace shell script with simple ts script for windows compatability

* lint: use import statement instead of variable require
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 61a30273
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
], ],
"scripts": { "scripts": {
"build:forge": "forge build", "build:forge": "forge build",
"prebuild": "yarn ts-node scripts/verifyFoundryInstall.ts",
"build": "hardhat compile && tsc && hardhat typechain", "build": "hardhat compile && tsc && hardhat typechain",
"build:ts": "tsc", "build:ts": "tsc",
"test": "forge test", "test": "forge test",
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
}, },
"devDependencies": { "devDependencies": {
"@foundry-rs/hardhat-forge": "^0.1.5", "@foundry-rs/hardhat-forge": "^0.1.5",
"command-exists": "1.2.9",
"@eth-optimism/hardhat-deploy-config": "^0.1.0", "@eth-optimism/hardhat-deploy-config": "^0.1.0",
"@nomiclabs/hardhat-ethers": "^2.0.0", "@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-etherscan": "^2.1.3", "@nomiclabs/hardhat-etherscan": "^2.1.3",
......
import { sync as commandExistsSync } from 'command-exists'
if (!commandExistsSync('forge')) {
console.error(
'Command failed. Is Foundry not installed? Consider installing via `curl -L https://foundry.paradigm.xyz | bash` and then running `foundryup` on a new terminal. For more context, check the installation instructions in the book: https://book.getfoundry.sh/getting-started/installation.html.'
)
process.exit(1)
}
...@@ -6147,7 +6147,7 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: ...@@ -6147,7 +6147,7 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6:
dependencies: dependencies:
delayed-stream "~1.0.0" delayed-stream "~1.0.0"
command-exists@^1.2.8, command-exists@^1.2.9: command-exists@1.2.9, command-exists@^1.2.8, command-exists@^1.2.9:
version "1.2.9" version "1.2.9"
resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69"
integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment