Skip to content

Commit

Permalink
Add preinstall script to install foundry
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejearley committed Jul 27, 2023
1 parent 529e7ac commit 93cd1aa
Show file tree
Hide file tree
Showing 5 changed files with 261 additions and 240 deletions.
3 changes: 3 additions & 0 deletions common/helpers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ export async function run(command: string) {
process.stdout.write(chunk.toString())
data += chunk.toString()
})
child.stderr?.on('data', chunk => {
process.stdout.write(chunk.toString())
})
child.on('exit', () => {
resolve(data)
})
Expand Down
3 changes: 2 additions & 1 deletion contracts/ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"docgen": "npx hardhat docgen",
"test": "npx esno scripts/test.ts",
"clean": "npx hardhat clean",
"build": "npx hardhat compile --show-stack-traces"
"build": "npx hardhat compile --show-stack-traces",
"preinstall": "npx esno scripts/preinstall.ts"
},
"dependencies": {
"@chainlink/contracts": "^0.6.1",
Expand Down
9 changes: 9 additions & 0 deletions contracts/ethereum/scripts/preinstall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { run } from '@casimir/helpers'

void async function () {
const foundryCheck = await run('foundry --version')
console.log('foundryCheck', foundryCheck)
if (!foundryCheck) {
await run('curl -L https://foundry.paradigm.xyz | bash -s -- --yes && foundryup')
}
}()
Loading

0 comments on commit 93cd1aa

Please sign in to comment.